• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 600
  • Last Modified:

VB Script to monitor date/time modified folder

Hi experts,

I must create a script to monitor a folder if it has not been modified because the files that are alocated on that folder stay there only a few seconds, so I thing the best way is to monitor not the files but the last modified date of the folder that contains those files. I plan to run the script remotely.

The script should show a message like this: Wscript.Echo "Message: last date/time modified", and an output error like this: Wscript.Quit(4), if the last date modified is less than 30 minutes of the current date/time.

Thanks in advance for your help
0
andressk
Asked:
andressk
1 Solution
 
prashanthdCommented:
Hi,

Try the following code.

regards
Prashanth

Folder_Path = "\\servername\drivename$\foldername" 'Example \\DCSERVER01\c$\monitor

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objFolder = objFSO.GetFolder(Folder_Path)

WScript.Echo "Message:" & objfolder.DateLastModified

If DateDiff("n",objfolder.DateLastModified,Now)< 30 Then
      WScript.Echo "Modified time < 30 Mins"
      WScript.Quit(4)
End If
0
 
andresskAuthor Commented:
It worked perfectly.
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now