Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > File monitoring

Reply
Thread Tools Display Modes

File monitoring

 
 
John
Guest
Posts: n/a

 
      01-06-2009
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.


 
Reply With Quote
 
 
 
 
Pegasus \(MVP\)
Guest
Posts: n/a

 
      01-06-2009

"John" <> wrote in message
news:F7A0CB9B-CCE9-4234-B32B-...
> 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 = ""
27. .To = ""
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") = ""
42. .Item (schema & "sendpassword") = "SomePassword"
43. End With
44. .Configuration.Fields.Update
45. .Send
46. End With


 
Reply With Quote
 
John
Guest
Posts: n/a

 
      01-07-2009
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" <> wrote in message
> news:F7A0CB9B-CCE9-4234-B32B-...
> > 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 = ""
> 27. .To = ""
> 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") = ""
> 42. .Item (schema & "sendpassword") = "SomePassword"
> 43. End With
> 44. .Configuration.Fields.Update
> 45. .Send
> 46. End With
>
>
>

 
Reply With Quote
 
Al Dunbar
Guest
Posts: n/a

 
      01-07-2009

"John" <> wrote in message
news:265DAFAF-F248-4107-8FF5-...
> 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



>
>
>
> "Pegasus (MVP)" wrote:
>
>>
>> "John" <> wrote in message
>> news:F7A0CB9B-CCE9-4234-B32B-...
>> > 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 = ""
>> 27. .To = ""
>> 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") = ""
>> 42. .Item (schema & "sendpassword") = "SomePassword"
>> 43. End With
>> 44. .Configuration.Fields.Update
>> 45. .Send
>> 46. End With
>>
>>
>>



 
Reply With Quote
 
Pegasus \(MVP\)
Guest
Posts: n/a

 
      01-07-2009
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" <> wrote in message
news:265DAFAF-F248-4107-8FF5-...
> 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" <> wrote in message
>> news:F7A0CB9B-CCE9-4234-B32B-...
>> > 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 = ""
>> 27. .To = ""
>> 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") = ""
>> 42. .Item (schema & "sendpassword") = "SomePassword"
>> 43. End With
>> 44. .Configuration.Fields.Update
>> 45. .Send
>> 46. End With
>>
>>
>>



 
Reply With Quote
 
John
Guest
Posts: n/a

 
      01-08-2009
Thank you both for your support, everything is working very well...
You're great.

Best regards.

"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" <> wrote in message
> news:265DAFAF-F248-4107-8FF5-...
> > 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" <> wrote in message
> >> news:F7A0CB9B-CCE9-4234-B32B-...
> >> > 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 = ""
> >> 27. .To = ""
> >> 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") = ""
> >> 42. .Item (schema & "sendpassword") = "SomePassword"
> >> 43. End With
> >> 44. .Configuration.Fields.Update
> >> 45. .Send
> >> 46. End With
> >>
> >>
> >>

>
>
>

 
Reply With Quote
 
Pegasus \(MVP\)
Guest
Posts: n/a

 
      01-08-2009
Thanks for the feedback. It would be interesting to know why the program did
not work initially!

"John" <> wrote in message
news:A4327144-8339-4CDB-8425-...
> Thank you both for your support, everything is working very well...
> You're great.
>
> Best regards.
>



 
Reply With Quote
 
John
Guest
Posts: n/a

 
      01-13-2009
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 . 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" <> wrote in message
> news:A4327144-8339-4CDB-8425-...
> > Thank you both for your support, everything is working very well...
> > You're great.
> >
> > Best regards.
> >

>
>
>

 
Reply With Quote
 
Pegasus \(MVP\)
Guest
Posts: n/a

 
      01-13-2009

"John" <> wrote in message
news:8ED1B34A-929F-4907-B689-...
> 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 . 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.


 
Reply With Quote
 
Allan Miller
Guest
Posts: n/a

 
      01-23-2009
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/scr...5/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

"John" <> wrote in message
news:8ED1B34A-929F-4907-B689-...
> 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 . 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" <> wrote in message
>> news:A4327144-8339-4CDB-8425-...
>> > Thank you both for your support, everything is working very well...
>> > You're great.
>> >
>> > Best regards.
>> >

>>
>>
>>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: file monitoring Paul Weterings Windows Server 0 10-24-2008 03:03 PM
Monitoring and reporting - big .log file Totach Windows Small Business Server 1 05-11-2005 10:12 AM
File System Monitoring David Scripting 0 11-09-2004 09:23 PM
File Monitoring help iusr_scott Scripting 0 05-03-2004 05:02 PM
file monitoring Moley Scripting 3 10-09-2003 04:52 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59