Advertisement
Tugamars_PT

Untitled

Oct 2nd, 2016
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. $watcher = New-Object System.IO.FileSystemWatcher
  2. $watcher.Path = "C:\VIDEOS_E_CONTEUDOS\STREAM_SYSTEM\replays\movies"
  3. $watcher.Filter = "*.mp4"
  4. $watcher.IncludeSubdirectories = $false
  5. $watcher.EnableRaisingEvents = $false
  6. $watcher.NotifyFilter = [System.IO.NotifyFilters]::LastWrite -bor [System.IO.NotifyFilters]::FileName
  7.  
  8. while($TRUE){
  9. $result = $watcher.WaitForChanged([System.IO.WatcherChangeTypes]::Changed -bor [System.IO.WatcherChangeTypes]::Renamed -bOr [System.IO.WatcherChangeTypes]::Created, 1000);
  10. if($result.TimedOut){
  11. continue;
  12. }
  13. write-host "Change in " + $result.Name
  14. $folderf = "C:\VIDEOS_E_CONTEUDOS\STREAM_SYSTEM\replays\movies\" + $result.Name;
  15. Copy-Item $folderf -Destination "C:\VIDEOS_E_CONTEUDOS\STREAM_SYSTEM\replays\replay.mp4" -Force -Verbose
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement