Trigger script when new folder has been added to a location
automation, powershell
Solution
Personnaly I'ld use System.IO.FileSystemWatcher
$folder = 'c:\myfoldertowatch'
$filter = '*.*'
$fsw = New-Object IO.FileSystemWatcher $folder, $filter
$fsw.IncludeSubdirectories = $true
$fsw.NotifyFilter = [IO.NotifyFilters]'DirectoryName' # just notify directory name events
$onCreated = Register-ObjectEvent $fsw Created -SourceIdentifier FileCreated -Action { ... do my stuff here } # and only when is created
Use this to stop watching event
Unregister-Event -SourceIdentifier FileCreated
Problem
I'm automating a process and already made a powershell script for that. Now I need to make something which will call that script everytime a new folder has been added to a specific location i.e. a new build is dropped. What should I use for this. Is WCF too much? And if not, got any leads for that? Any useful links. Or is another powershell script better for that? Keep in mind I need to check subfolders too. Thanks.