Last active
May 9, 2018 18:39
-
-
Save colonelpopcorn/890afef2327c647afa16d38c0d239387 to your computer and use it in GitHub Desktop.
This file contains 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
# https://stackoverflow.com/questions/12319382/file-system-watcher-event-when-run-using-a-script#12323930 | |
$watcher = new-object System.IO.FileSystemWatcher | |
$watcher.Path = '.\' | |
$watcher.Filter = '*.js' # whatever you need | |
#$watcher.IncludeSubDirectories = $true # if needed | |
$watcher.EnableRaisingEvents = $true | |
Register-ObjectEvent $watcher -EventName Changed -SourceIdentifier 'Watcher' -Action { param($sender, $eventArgs) | |
Write-Host "Detected change in files copying..."; | |
# code to run copy/build script here | |
Write-Host "Done copying..."; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment