Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $watcher = New-Object System.IO.FileSystemWatcher
- $watcher.Path = "C:\VIDEOS_E_CONTEUDOS\STREAM_SYSTEM\replays\movies"
- $watcher.Filter = "*.mp4"
- $watcher.IncludeSubdirectories = $false
- $watcher.EnableRaisingEvents = $false
- $watcher.NotifyFilter = [System.IO.NotifyFilters]::LastWrite -bor [System.IO.NotifyFilters]::FileName
- while($TRUE){
- $result = $watcher.WaitForChanged([System.IO.WatcherChangeTypes]::Changed -bor [System.IO.WatcherChangeTypes]::Renamed -bOr [System.IO.WatcherChangeTypes]::Created, 1000);
- if($result.TimedOut){
- continue;
- }
- write-host "Change in " + $result.Name
- $folderf = "C:\VIDEOS_E_CONTEUDOS\STREAM_SYSTEM\replays\movies\" + $result.Name;
- Copy-Item $folderf -Destination "C:\VIDEOS_E_CONTEUDOS\STREAM_SYSTEM\replays\replay.mp4" -Force -Verbose
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement