Home All Groups Group Topic Archive Search About
Author
6 Jan 2009 1:03 PM
John
Hello everyone,

I've a a script that every hour move files inside several directories to a
diferent server that is outside of our newtwork, this is done with a schedule
batch file that runs every 30 minutes. The problem is that sometimes this
process crashes and the files are not transferred, generally this is only
reported when users start to complain about that because their files are not
where should be.

So, I have to create a script that searches between several directories (5
directories to be exact) and look at the files inside, if those files where
created, for example "3 hours ago", that means that those files should
already be transferred to the other server, if they're in that directory,
that means that there is some problem in the server and someone should take a
look at that.

In sum, I need a batch file that runs every hour and search across those
directories for files that were created 3 or mor hours ago, if there is files
in those conditions, then the batch should send a warning mail to a specific
mailbox containing the path of the directory and the server name.

I'm new to scripting, can anyone help me on this one?


Thank you guys for your time.
BTW: I'm learning a lot with the great job that people do here.

Author
6 Jan 2009 2:23 PM
Pegasus (MVP)
Show quote Hide quote
"John" <J***@discussions.microsoft.com> wrote in message
news:F7A0CB9B-CCE9-4234-B32B-2508FA3395AB@microsoft.com...
> Hello everyone,
>
> I've a a script that every hour move files inside several directories to a
> diferent server that is outside of our newtwork, this is done with a
> schedule
> batch file that runs every 30 minutes. The problem is that sometimes this
> process crashes and the files are not transferred, generally this is only
> reported when users start to complain about that because their files are
> not
> where should be.
>
> So, I have to create a script that searches between several directories (5
> directories to be exact) and look at the files inside, if those files
> where
> created, for example "3 hours ago", that means that those files should
> already be transferred to the other server, if they're in that directory,
> that means that there is some problem in the server and someone should
> take a
> look at that.
>
> In sum, I need a batch file that runs every hour and search across those
> directories for files that were created 3 or mor hours ago, if there is
> files
> in those conditions, then the batch should send a warning mail to a
> specific
> mailbox containing the path of the directory and the server name.
>
> I'm new to scripting, can anyone help me on this one?
>
>
> Thank you guys for your time.
> BTW: I'm learning a lot with the great job that people do here.

Your first job should really be to find out why the "move" process fails on
occasion. In this way you could treat the cause of your problem instead of
the symptoms. If this is not possible then you could use the script below.
While it is probably possible to write a batch file as per your request,
this would be a painful exercise because batch files do not have native
functions for date caclulations.

Pay attention to separate your folder names in Line 02 with vertical bars,
not spaces.

01. iInterval = 3 'hours
02. aFolders = Split("c:\Folder1|d:\Folder 2|c:\Some Folder", "|")
03.
04. LF = Chr(10)
05. Set oFSO = CreateObject("Scripting.FileSystemObject")
06. ReDim aFileCount(UBound(afolders))
07. For i = 0 To UBound(aFolders)
08.  aFileCount(i) = 0
09. Next
10.
11. bFound = False
12. For i = 0 To UBound(aFolders)
13.  Set oFiles = oFSO.GetFolder(aFolders(i)).Files
14.  For Each oFile In oFiles
15.   If DateDiff("h", oFile.DateLastModified, Now()) > iInterval Then
16.    bFound = True
17.    aFileCount(i) = aFileCount(i) + 1
18.   End If
19.  Next
20. Next
21. if not bFound then WScript.Quit
22.
23. schema = "http://schemas.microsoft.com/cdo/configuration/"
24. Set objEmail = CreateObject("CDO.Message")
25. With objEmail
26.  .From = "Ja***@company.com"
27.  .To = "J**@company.com"
28.  .Subject = "Alert - some old files were found"
29.  .TextBody = ""
30.  For i = 0 To UBound(aFolders)
31.   .TextBody = .TextBody & Right("   " & aFileCount(i), 4) _
32.   & " " & aFolders(i) & LF
33.  Next
34.  '.AddAttachment "d:\Testfile.txt"
35.  WScript.Echo .textbody
36.   With .Configuration.Fields
37.   .Item (schema & "sendusing") = 2
38.   .Item (schema & "smtpserver") = "mail.company.com"
39.   .Item (schema & "smtpserverport") = 25
40.   .Item (schema & "smtpauthenticate") = cdoBasic
41.   .Item (schema & "sendusername") = "Ja***@company.com"
42.   .Item (schema & "sendpassword") = "SomePassword"
43.   End With
44.  .Configuration.Fields.Update
45.  .Send
46. End With
Are all your drivers up to date? click for free checkup

Author
7 Jan 2009 11:07 AM
John
Hi Pegasus,

Thank you for your answer. In fact we know what causes our script to
sometimes break, but we can't do anything at the moment, so we need an
alternative solution to monitor that folder.


I did a test your script and everything works great, EXCEPT that I never
receive the warning mail because the bFound variable always returns false,
can you help me on that?



Show quoteHide quote
"Pegasus (MVP)" wrote:

>
> "John" <J***@discussions.microsoft.com> wrote in message
> news:F7A0CB9B-CCE9-4234-B32B-2508FA3395AB@microsoft.com...
> > Hello everyone,
> >
> > I've a a script that every hour move files inside several directories to a
> > diferent server that is outside of our newtwork, this is done with a
> > schedule
> > batch file that runs every 30 minutes. The problem is that sometimes this
> > process crashes and the files are not transferred, generally this is only
> > reported when users start to complain about that because their files are
> > not
> > where should be.
> >
> > So, I have to create a script that searches between several directories (5
> > directories to be exact) and look at the files inside, if those files
> > where
> > created, for example "3 hours ago", that means that those files should
> > already be transferred to the other server, if they're in that directory,
> > that means that there is some problem in the server and someone should
> > take a
> > look at that.
> >
> > In sum, I need a batch file that runs every hour and search across those
> > directories for files that were created 3 or mor hours ago, if there is
> > files
> > in those conditions, then the batch should send a warning mail to a
> > specific
> > mailbox containing the path of the directory and the server name.
> >
> > I'm new to scripting, can anyone help me on this one?
> >
> >
> > Thank you guys for your time.
> > BTW: I'm learning a lot with the great job that people do here.
>
> Your first job should really be to find out why the "move" process fails on
> occasion. In this way you could treat the cause of your problem instead of
> the symptoms. If this is not possible then you could use the script below.
> While it is probably possible to write a batch file as per your request,
> this would be a painful exercise because batch files do not have native
> functions for date caclulations.
>
> Pay attention to separate your folder names in Line 02 with vertical bars,
> not spaces.
>
> 01. iInterval = 3 'hours
> 02. aFolders = Split("c:\Folder1|d:\Folder 2|c:\Some Folder", "|")
> 03.
> 04. LF = Chr(10)
> 05. Set oFSO = CreateObject("Scripting.FileSystemObject")
> 06. ReDim aFileCount(UBound(afolders))
> 07. For i = 0 To UBound(aFolders)
> 08.  aFileCount(i) = 0
> 09. Next
> 10.
> 11. bFound = False
> 12. For i = 0 To UBound(aFolders)
> 13.  Set oFiles = oFSO.GetFolder(aFolders(i)).Files
> 14.  For Each oFile In oFiles
> 15.   If DateDiff("h", oFile.DateLastModified, Now()) > iInterval Then
> 16.    bFound = True
> 17.    aFileCount(i) = aFileCount(i) + 1
> 18.   End If
> 19.  Next
> 20. Next
> 21. if not bFound then WScript.Quit
> 22.
> 23. schema = "http://schemas.microsoft.com/cdo/configuration/"
> 24. Set objEmail = CreateObject("CDO.Message")
> 25. With objEmail
> 26.  .From = "Ja***@company.com"
> 27.  .To = "J**@company.com"
> 28.  .Subject = "Alert - some old files were found"
> 29.  .TextBody = ""
> 30.  For i = 0 To UBound(aFolders)
> 31.   .TextBody = .TextBody & Right("   " & aFileCount(i), 4) _
> 32.   & " " & aFolders(i) & LF
> 33.  Next
> 34.  '.AddAttachment "d:\Testfile.txt"
> 35.  WScript.Echo .textbody
> 36.   With .Configuration.Fields
> 37.   .Item (schema & "sendusing") = 2
> 38.   .Item (schema & "smtpserver") = "mail.company.com"
> 39.   .Item (schema & "smtpserverport") = 25
> 40.   .Item (schema & "smtpauthenticate") = cdoBasic
> 41.   .Item (schema & "sendusername") = "Ja***@company.com"
> 42.   .Item (schema & "sendpassword") = "SomePassword"
> 43.   End With
> 44.  .Configuration.Fields.Update
> 45.  .Send
> 46. End With
>
>
>
Author
7 Jan 2009 12:51 PM
Al Dunbar
"John" <J***@discussions.microsoft.com> wrote in message
news:265DAFAF-F248-4107-8FF5-C1B39E6E46AE@microsoft.com...
> Hi Pegasus,
>
> Thank you for your answer. In fact we know what causes our script to
> sometimes break, but we can't do anything at the moment, so we need an
> alternative solution to monitor that folder.
>
>
> I did a test your script and everything works great, EXCEPT that I never
> receive the warning mail because the bFound variable always returns false,
> can you help me on that?

The statement:

    if not bFound then WScript.Quit

should force an exit before the email-sending code if bFound is false (i.e.
if "not bFound" is true). Either you have no files older than 3 hours in
those folders, or DateDiff is returning a negative value. I can never
remember which of the two dates is subtracted from the other, so would
suggest changing this:

  If DateDiff("h", oFile.DateLastModified, Now()) > iInterval Then


to this:

  If abs(DateDiff("h", oFile.DateLastModified, Now())) > iInterval Then

/Al



Show quoteHide quote
>
>
>
> "Pegasus (MVP)" wrote:
>
>>
>> "John" <J***@discussions.microsoft.com> wrote in message
>> news:F7A0CB9B-CCE9-4234-B32B-2508FA3395AB@microsoft.com...
>> > Hello everyone,
>> >
>> > I've a a script that every hour move files inside several directories
>> > to a
>> > diferent server that is outside of our newtwork, this is done with a
>> > schedule
>> > batch file that runs every 30 minutes. The problem is that sometimes
>> > this
>> > process crashes and the files are not transferred, generally this is
>> > only
>> > reported when users start to complain about that because their files
>> > are
>> > not
>> > where should be.
>> >
>> > So, I have to create a script that searches between several directories
>> > (5
>> > directories to be exact) and look at the files inside, if those files
>> > where
>> > created, for example "3 hours ago", that means that those files should
>> > already be transferred to the other server, if they're in that
>> > directory,
>> > that means that there is some problem in the server and someone should
>> > take a
>> > look at that.
>> >
>> > In sum, I need a batch file that runs every hour and search across
>> > those
>> > directories for files that were created 3 or mor hours ago, if there is
>> > files
>> > in those conditions, then the batch should send a warning mail to a
>> > specific
>> > mailbox containing the path of the directory and the server name.
>> >
>> > I'm new to scripting, can anyone help me on this one?
>> >
>> >
>> > Thank you guys for your time.
>> > BTW: I'm learning a lot with the great job that people do here.
>>
>> Your first job should really be to find out why the "move" process fails
>> on
>> occasion. In this way you could treat the cause of your problem instead
>> of
>> the symptoms. If this is not possible then you could use the script
>> below.
>> While it is probably possible to write a batch file as per your request,
>> this would be a painful exercise because batch files do not have native
>> functions for date caclulations.
>>
>> Pay attention to separate your folder names in Line 02 with vertical
>> bars,
>> not spaces.
>>
>> 01. iInterval = 3 'hours
>> 02. aFolders = Split("c:\Folder1|d:\Folder 2|c:\Some Folder", "|")
>> 03.
>> 04. LF = Chr(10)
>> 05. Set oFSO = CreateObject("Scripting.FileSystemObject")
>> 06. ReDim aFileCount(UBound(afolders))
>> 07. For i = 0 To UBound(aFolders)
>> 08.  aFileCount(i) = 0
>> 09. Next
>> 10.
>> 11. bFound = False
>> 12. For i = 0 To UBound(aFolders)
>> 13.  Set oFiles = oFSO.GetFolder(aFolders(i)).Files
>> 14.  For Each oFile In oFiles
>> 15.   If DateDiff("h", oFile.DateLastModified, Now()) > iInterval Then
>> 16.    bFound = True
>> 17.    aFileCount(i) = aFileCount(i) + 1
>> 18.   End If
>> 19.  Next
>> 20. Next
>> 21. if not bFound then WScript.Quit
>> 22.
>> 23. schema = "http://schemas.microsoft.com/cdo/configuration/"
>> 24. Set objEmail = CreateObject("CDO.Message")
>> 25. With objEmail
>> 26.  .From = "Ja***@company.com"
>> 27.  .To = "J**@company.com"
>> 28.  .Subject = "Alert - some old files were found"
>> 29.  .TextBody = ""
>> 30.  For i = 0 To UBound(aFolders)
>> 31.   .TextBody = .TextBody & Right("   " & aFileCount(i), 4) _
>> 32.   & " " & aFolders(i) & LF
>> 33.  Next
>> 34.  '.AddAttachment "d:\Testfile.txt"
>> 35.  WScript.Echo .textbody
>> 36.   With .Configuration.Fields
>> 37.   .Item (schema & "sendusing") = 2
>> 38.   .Item (schema & "smtpserver") = "mail.company.com"
>> 39.   .Item (schema & "smtpserverport") = 25
>> 40.   .Item (schema & "smtpauthenticate") = cdoBasic
>> 41.   .Item (schema & "sendusername") = "Ja***@company.com"
>> 42.   .Item (schema & "sendpassword") = "SomePassword"
>> 43.   End With
>> 44.  .Configuration.Fields.Update
>> 45.  .Send
>> 46. End With
>>
>>
>>
Author
7 Jan 2009 4:46 PM
Pegasus (MVP)
Insert Line 14a. as follows:
wscript.echo oFile.Name & " " & DateDiff("h", oFile.DateLastModified, Now())

You will now see the age of each file on the screen, provided you run the
command in a Command Prompt and not from the Run box.

Show quoteHide quote
"John" <J***@discussions.microsoft.com> wrote in message
news:265DAFAF-F248-4107-8FF5-C1B39E6E46AE@microsoft.com...
> Hi Pegasus,
>
> Thank you for your answer. In fact we know what causes our script to
> sometimes break, but we can't do anything at the moment, so we need an
> alternative solution to monitor that folder.
>
>
> I did a test your script and everything works great, EXCEPT that I never
> receive the warning mail because the bFound variable always returns false,
> can you help me on that?
>
>
>
> "Pegasus (MVP)" wrote:
>
>>
>> "John" <J***@discussions.microsoft.com> wrote in message
>> news:F7A0CB9B-CCE9-4234-B32B-2508FA3395AB@microsoft.com...
>> > Hello everyone,
>> >
>> > I've a a script that every hour move files inside several directories
>> > to a
>> > diferent server that is outside of our newtwork, this is done with a
>> > schedule
>> > batch file that runs every 30 minutes. The problem is that sometimes
>> > this
>> > process crashes and the files are not transferred, generally this is
>> > only
>> > reported when users start to complain about that because their files
>> > are
>> > not
>> > where should be.
>> >
>> > So, I have to create a script that searches between several directories
>> > (5
>> > directories to be exact) and look at the files inside, if those files
>> > where
>> > created, for example "3 hours ago", that means that those files should
>> > already be transferred to the other server, if they're in that
>> > directory,
>> > that means that there is some problem in the server and someone should
>> > take a
>> > look at that.
>> >
>> > In sum, I need a batch file that runs every hour and search across
>> > those
>> > directories for files that were created 3 or mor hours ago, if there is
>> > files
>> > in those conditions, then the batch should send a warning mail to a
>> > specific
>> > mailbox containing the path of the directory and the server name.
>> >
>> > I'm new to scripting, can anyone help me on this one?
>> >
>> >
>> > Thank you guys for your time.
>> > BTW: I'm learning a lot with the great job that people do here.
>>
>> Your first job should really be to find out why the "move" process fails
>> on
>> occasion. In this way you could treat the cause of your problem instead
>> of
>> the symptoms. If this is not possible then you could use the script
>> below.
>> While it is probably possible to write a batch file as per your request,
>> this would be a painful exercise because batch files do not have native
>> functions for date caclulations.
>>
>> Pay attention to separate your folder names in Line 02 with vertical
>> bars,
>> not spaces.
>>
>> 01. iInterval = 3 'hours
>> 02. aFolders = Split("c:\Folder1|d:\Folder 2|c:\Some Folder", "|")
>> 03.
>> 04. LF = Chr(10)
>> 05. Set oFSO = CreateObject("Scripting.FileSystemObject")
>> 06. ReDim aFileCount(UBound(afolders))
>> 07. For i = 0 To UBound(aFolders)
>> 08.  aFileCount(i) = 0
>> 09. Next
>> 10.
>> 11. bFound = False
>> 12. For i = 0 To UBound(aFolders)
>> 13.  Set oFiles = oFSO.GetFolder(aFolders(i)).Files
>> 14.  For Each oFile In oFiles
>> 15.   If DateDiff("h", oFile.DateLastModified, Now()) > iInterval Then
>> 16.    bFound = True
>> 17.    aFileCount(i) = aFileCount(i) + 1
>> 18.   End If
>> 19.  Next
>> 20. Next
>> 21. if not bFound then WScript.Quit
>> 22.
>> 23. schema = "http://schemas.microsoft.com/cdo/configuration/"
>> 24. Set objEmail = CreateObject("CDO.Message")
>> 25. With objEmail
>> 26.  .From = "Ja***@company.com"
>> 27.  .To = "J**@company.com"
>> 28.  .Subject = "Alert - some old files were found"
>> 29.  .TextBody = ""
>> 30.  For i = 0 To UBound(aFolders)
>> 31.   .TextBody = .TextBody & Right("   " & aFileCount(i), 4) _
>> 32.   & " " & aFolders(i) & LF
>> 33.  Next
>> 34.  '.AddAttachment "d:\Testfile.txt"
>> 35.  WScript.Echo .textbody
>> 36.   With .Configuration.Fields
>> 37.   .Item (schema & "sendusing") = 2
>> 38.   .Item (schema & "smtpserver") = "mail.company.com"
>> 39.   .Item (schema & "smtpserverport") = 25
>> 40.   .Item (schema & "smtpauthenticate") = cdoBasic
>> 41.   .Item (schema & "sendusername") = "Ja***@company.com"
>> 42.   .Item (schema & "sendpassword") = "SomePassword"
>> 43.   End With
>> 44.  .Configuration.Fields.Update
>> 45.  .Send
>> 46. End With
>>
>>
>>
Author
8 Jan 2009 9:07 PM
John
Thank you both for your support, everything is working very well...
You're great.

Best regards.

Show quoteHide quote
"Pegasus (MVP)" wrote:

> Insert Line 14a. as follows:
> wscript.echo oFile.Name & " " & DateDiff("h", oFile.DateLastModified, Now())
>
> You will now see the age of each file on the screen, provided you run the
> command in a Command Prompt and not from the Run box.
>
> "John" <J***@discussions.microsoft.com> wrote in message
> news:265DAFAF-F248-4107-8FF5-C1B39E6E46AE@microsoft.com...
> > Hi Pegasus,
> >
> > Thank you for your answer. In fact we know what causes our script to
> > sometimes break, but we can't do anything at the moment, so we need an
> > alternative solution to monitor that folder.
> >
> >
> > I did a test your script and everything works great, EXCEPT that I never
> > receive the warning mail because the bFound variable always returns false,
> > can you help me on that?
> >
> >
> >
> > "Pegasus (MVP)" wrote:
> >
> >>
> >> "John" <J***@discussions.microsoft.com> wrote in message
> >> news:F7A0CB9B-CCE9-4234-B32B-2508FA3395AB@microsoft.com...
> >> > Hello everyone,
> >> >
> >> > I've a a script that every hour move files inside several directories
> >> > to a
> >> > diferent server that is outside of our newtwork, this is done with a
> >> > schedule
> >> > batch file that runs every 30 minutes. The problem is that sometimes
> >> > this
> >> > process crashes and the files are not transferred, generally this is
> >> > only
> >> > reported when users start to complain about that because their files
> >> > are
> >> > not
> >> > where should be.
> >> >
> >> > So, I have to create a script that searches between several directories
> >> > (5
> >> > directories to be exact) and look at the files inside, if those files
> >> > where
> >> > created, for example "3 hours ago", that means that those files should
> >> > already be transferred to the other server, if they're in that
> >> > directory,
> >> > that means that there is some problem in the server and someone should
> >> > take a
> >> > look at that.
> >> >
> >> > In sum, I need a batch file that runs every hour and search across
> >> > those
> >> > directories for files that were created 3 or mor hours ago, if there is
> >> > files
> >> > in those conditions, then the batch should send a warning mail to a
> >> > specific
> >> > mailbox containing the path of the directory and the server name.
> >> >
> >> > I'm new to scripting, can anyone help me on this one?
> >> >
> >> >
> >> > Thank you guys for your time.
> >> > BTW: I'm learning a lot with the great job that people do here.
> >>
> >> Your first job should really be to find out why the "move" process fails
> >> on
> >> occasion. In this way you could treat the cause of your problem instead
> >> of
> >> the symptoms. If this is not possible then you could use the script
> >> below.
> >> While it is probably possible to write a batch file as per your request,
> >> this would be a painful exercise because batch files do not have native
> >> functions for date caclulations.
> >>
> >> Pay attention to separate your folder names in Line 02 with vertical
> >> bars,
> >> not spaces.
> >>
> >> 01. iInterval = 3 'hours
> >> 02. aFolders = Split("c:\Folder1|d:\Folder 2|c:\Some Folder", "|")
> >> 03.
> >> 04. LF = Chr(10)
> >> 05. Set oFSO = CreateObject("Scripting.FileSystemObject")
> >> 06. ReDim aFileCount(UBound(afolders))
> >> 07. For i = 0 To UBound(aFolders)
> >> 08.  aFileCount(i) = 0
> >> 09. Next
> >> 10.
> >> 11. bFound = False
> >> 12. For i = 0 To UBound(aFolders)
> >> 13.  Set oFiles = oFSO.GetFolder(aFolders(i)).Files
> >> 14.  For Each oFile In oFiles
> >> 15.   If DateDiff("h", oFile.DateLastModified, Now()) > iInterval Then
> >> 16.    bFound = True
> >> 17.    aFileCount(i) = aFileCount(i) + 1
> >> 18.   End If
> >> 19.  Next
> >> 20. Next
> >> 21. if not bFound then WScript.Quit
> >> 22.
> >> 23. schema = "http://schemas.microsoft.com/cdo/configuration/"
> >> 24. Set objEmail = CreateObject("CDO.Message")
> >> 25. With objEmail
> >> 26.  .From = "Ja***@company.com"
> >> 27.  .To = "J**@company.com"
> >> 28.  .Subject = "Alert - some old files were found"
> >> 29.  .TextBody = ""
> >> 30.  For i = 0 To UBound(aFolders)
> >> 31.   .TextBody = .TextBody & Right("   " & aFileCount(i), 4) _
> >> 32.   & " " & aFolders(i) & LF
> >> 33.  Next
> >> 34.  '.AddAttachment "d:\Testfile.txt"
> >> 35.  WScript.Echo .textbody
> >> 36.   With .Configuration.Fields
> >> 37.   .Item (schema & "sendusing") = 2
> >> 38.   .Item (schema & "smtpserver") = "mail.company.com"
> >> 39.   .Item (schema & "smtpserverport") = 25
> >> 40.   .Item (schema & "smtpauthenticate") = cdoBasic
> >> 41.   .Item (schema & "sendusername") = "Ja***@company.com"
> >> 42.   .Item (schema & "sendpassword") = "SomePassword"
> >> 43.   End With
> >> 44.  .Configuration.Fields.Update
> >> 45.  .Send
> >> 46. End With
> >>
> >>
> >>
>
>
>
Author
8 Jan 2009 9:24 PM
Pegasus (MVP)
Thanks for the feedback. It would be interesting to know why the program did
not work initially!

Show quoteHide quote
"John" <J***@discussions.microsoft.com> wrote in message
news:A4327144-8339-4CDB-8425-180C6971CAD7@microsoft.com...
> Thank you both for your support, everything is working very well...
> You're great.
>
> Best regards.
>
Author
13 Jan 2009 2:25 PM
John
Hi Pegasus,

Sorry for the late response. Actually the script does not seem to have
problems, when I copy it for the second time to do a test in a diferent
server the script simply worked :D. So I guess that probably the mistake was
mine when copying those lines.

What is your opinion on Al's suggestion? Should I make the change?

I'm thinking in conver it to an exe file, do you recommend any software to
do this? Will the users be able to revert it back to vbs using anyother
software?

Thank you again.

Show quoteHide quote
"Pegasus (MVP)" wrote:

> Thanks for the feedback. It would be interesting to know why the program did
> not work initially!
>
> "John" <J***@discussions.microsoft.com> wrote in message
> news:A4327144-8339-4CDB-8425-180C6971CAD7@microsoft.com...
> > Thank you both for your support, everything is working very well...
> > You're great.
> >
> > Best regards.
> >
>
>
>
Author
13 Jan 2009 2:37 PM
Pegasus (MVP)
Show quote Hide quote
"John" <J***@discussions.microsoft.com> wrote in message
news:8ED1B34A-929F-4907-B689-B85C1B75671A@microsoft.com...
> Hi Pegasus,
>
> Sorry for the late response. Actually the script does not seem to have
> problems, when I copy it for the second time to do a test in a diferent
> server the script simply worked :D. So I guess that probably the mistake
> was
> mine when copying those lines.
>
> What is your opinion on Al's suggestion? Should I make the change?
>
> I'm thinking in conver it to an exe file, do you recommend any software to
> do this? Will the users be able to revert it back to vbs using anyother
> software?
>
> Thank you again.

Al's suggestion gets around the human problem of not always remembering
which way the DateDiff function works. He is in good company with this
problem . . .  His proposal turns all negative numbers into positive ones,
thus making it irrelevant which argument comes first in the DateDiff
function. Since your code works (which does not surprise me because I tested
it before posting!), making the change will make no difference. You can
therefore do as you please.
Author
23 Jan 2009 4:09 AM
Allan Miller
I know some time has passed on this one but I think you would better benefit
to use WMI to monitor File events.

Read this post from the Scripting Guy and understand how it works.

http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr05/hey0404.mspx

Before you do your file xfer do a Err.Clear so that there are no errors
known and after your xfer, test the Err.Number. If the Err.Number is not = 0
then you know something is not going right and you can send yourself a
email.

Allan

Show quoteHide quote
"John" <J***@discussions.microsoft.com> wrote in message
news:8ED1B34A-929F-4907-B689-B85C1B75671A@microsoft.com...
> Hi Pegasus,
>
> Sorry for the late response. Actually the script does not seem to have
> problems, when I copy it for the second time to do a test in a diferent
> server the script simply worked :D. So I guess that probably the mistake
> was
> mine when copying those lines.
>
> What is your opinion on Al's suggestion? Should I make the change?
>
> I'm thinking in conver it to an exe file, do you recommend any software to
> do this? Will the users be able to revert it back to vbs using anyother
> software?
>
> Thank you again.
>
> "Pegasus (MVP)" wrote:
>
>> Thanks for the feedback. It would be interesting to know why the program
>> did
>> not work initially!
>>
>> "John" <J***@discussions.microsoft.com> wrote in message
>> news:A4327144-8339-4CDB-8425-180C6971CAD7@microsoft.com...
>> > Thank you both for your support, everything is working very well...
>> > You're great.
>> >
>> > Best regards.
>> >
>>
>>
>>

Bookmark and Share

Post Thread options