grasshopper3 Posted July 22, 2010 Share Posted July 22, 2010 Hey, I am trying to monitor a dir for any .rar files. I am currently using something similar to what is below. Currently it only monitors that dir and no sub-dirs. I know if you monitor the root of the drive it will monitor all dirs on the drive, but is there a way to monitor only one dir and its sub-dirs? I realize that I can include the path that I want monitored in my IF Statement and monitor the root, but I feel that is only a work around for what I want. Does anyone have any ideas? expandcollapse popup#include <Array.au3> #include <FileSystemMonitor.au3> Local $path = @ScriptDir & "\TestDir" Global $MonitorArray[1][3], $MonitorCount = 0 ; Setup File System Monitoring _FileSysMonSetup(3, $Path, "") ; Main Loop WHile 1 ; Handle Directory related events _FileSysMonDirEventHandler() WEnd Func _FileSysMonActionEvent($event_type, $event_id, $event_value) Local $event_type_name Local $fs_event = ObjCreate("Scripting.Dictionary") Switch $event_type Case 0 $fs_event.item(Hex(0x00000001)) = "file added to the directory" $fs_event.item(Hex(0x00000002)) = "file removed from the directory" $fs_event.item(Hex(0x00000003)) = "file was modified" $fs_event.item(Hex(0x00000004)) = "file was renamed old name" $fs_event.item(Hex(0x00000005)) = "file was renamed new name" EndSwitch if StringLen($fs_event.item(Hex($event_id))) > 0 Then $event_type_name = $fs_event.item(Hex($event_id)) If StringInStr($event_value,".rar") And $event_type_name = "file added to the directory" Then FileWrite(@ScriptDir & '\Resources\UnRAR\UnRAR.log','"' & @ScriptDir & '\Resources\UnRAR\UnRAR.exe" x "' & $event_value & '" "' & @ScriptDir&'\CompleteDownloads\' & $event_value & '"' & @CRLF) EndIf EndIf EndFunc Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now