Tuesday, 17 May 2011

Monitoring file system changes with PowerShell

Create a new System.IO.FileSystemWatcher object, and set appropriate settings:  $watcher = New-Object System.IO.FileSystemWatcher
$watcher.Path = $searchPath
$watcher.IncludeSubdirectories = $true
$watcher.EnableRaisingEvents = $true .Path is the path that will be monitored, .IncludeSubdirectories tells the FileSystemWatcher to monitor all subdirectories of .Path
Now we need to define some

No comments:

Post a Comment