Sign in to follow this  
Followers 0
myspacee

monitor directory

5 posts in this topic

hello,

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,

m.

Share this post


Link to post
Share on other sites



DirGetSize()


[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

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: " & _
                objEventObject.TargetInstance.PartComponent
        Case "__InstanceDeletionEvent"
            Wscript.Echo "A file was just deleted: " & _
                objEventObject.TargetInstance.PartComponent
    End Select
Loop

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  
Followers 0