Created
October 20, 2015 12:40
-
-
Save Eroc33/5a3ca497a7bf044779fa 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
$input_folder = "C:\ScannedPDFS\" | |
$output_folder = "C:\ScannedPDFS\Deskewed\{0}" | |
### SET FOLDER TO WATCH + FILES TO WATCH + SUBFOLDERS YES/NO | |
$watcher = New-Object System.IO.FileSystemWatcher | |
$watcher.Path = $input_folder | |
$watcher.Filter = "*.pdf" | |
$watcher.IncludeSubdirectories = $false | |
$watcher.EnableRaisingEvents = $true | |
### DEFINE ACTIONS AFTER A EVENT IS DETECTED | |
$action = { | |
param($sender, $eventArgs) | |
$in_file = $eventArgs.FullPath | |
$out_file = $output_folder -f (Split-Path -Leaf $inFile) | |
pdfdwcmd.exe $in_file $out_file | |
} | |
### DECIDE WHICH EVENTS SHOULD BE WATCHED + SET CHECK FREQUENCY | |
$created = Register-ObjectEvent $watcher "Created" -Action $action | |
$changed = Register-ObjectEvent $watcher "Changed" -Action $action | |
$renamed = Register-ObjectEvent $watcher "Renamed" -Action $action | |
while ($true) {sleep 5} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment