Jump to content
Sign in to follow this  

monitor directory

Recommended Posts



try to monitor several directory that receive files randomly.

Encounter problem when 1 file come in and 1 file is deleted, so i can't take number of files as valid check,

Think to use size (kb) of directory, but don't know how to monitor this... (and its performance)

any brillant idea to script valid directory monitor ?

thank you,


Share this post

Link to post
Share on other sites


[right]~What can I say, I'm a Simplistic person[/right]

Share this post

Link to post
Share on other sites

Sysinternals - www.sysinternals.com


Filemon is an application that monitors and displays all file system activity on a system. It has advanced filtering and search capabilities that make it a powerful tool for exploring the way Windows works, seeing how applications use the files and DLLs, or tracking down problems in system or application configurations. 

Share this post

Link to post
Share on other sites

thats nice, didnt know that api calls also were already available in autoit.

i use this vb script when needed(WMI)

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
    ("SELECT * FROM __InstanceOperationEvent WITHIN 10 WHERE " _
        & "Targetinstance ISA 'CIM_DirectoryContainsFile' and " _
            & "TargetInstance.GroupComponent= " _
                & "'Win32_Directory.Name=""c:\\\\scripts""'")
Do While TRUE
    Set objEventObject = colMonitoredEvents.NextEvent()

    Select Case objEventObject.Path_.Class
        Case "__InstanceCreationEvent"
            Wscript.Echo "A new file was just created: " & _
        Case "__InstanceDeletionEvent"
            Wscript.Echo "A file was just deleted: " & _
    End Select

PS: this monitors only creation and deletion! probably u can query size and then monitor for size change... this is from ms website raw code. mine does have adaptation to my requiremnts..

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this