Created
October 31, 2015 15:19
-
-
Save vensko/274cd18c92e99b137124 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$wmi = new COM("winmgmts:{impersonationLevel=impersonate}!//./root/cimv2"); | |
$events = $wmi->ExecNotificationQuery("Select * From __InstanceOperationEvent Within 2 Where (Targetinstance Isa 'CIM_DataFile' Or Targetinstance Isa 'CIM_Directory') And TargetInstance.Drive='e:' And TargetInstance.Path='\\\\WATCH_DIRECTORY\\\\'"); | |
while ($latestEvent = $events->NextEvent()) { | |
print_r($latestEvent->Path_->Class); | |
print_r([ | |
$latestEvent->TargetInstance->Name, | |
$latestEvent->TargetInstance->Drive, | |
$latestEvent->TargetInstance->Path, | |
$latestEvent->TargetInstance->Extension, | |
$latestEvent->TargetInstance->FileSize, | |
$latestEvent->TargetInstance->Writeable, | |
]); | |
echo "\n\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment