1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-23 16:28:51 -05:00
filebot/website/scripts/watcher.groovy
Reinhard Pointner 4e20fca248 * clean-up
2012-01-05 05:30:22 +00:00

19 lines
666 B
Groovy

// filebot -script "http://filebot.sf.net/scripts/watcher.groovy" --format <expression> <folder>
// SANITY CHECK
if (_prop['java.runtime.version'] < '1.7') throw new Exception('Java 7 required')
if (!(new File(_args.format ?: '').absolute)) throw new Exception('Absolute target path format required')
// watch folders and print files that were added/modified (requires Java 7)
def watchman = args.watch { changes ->
println "Processing $changes"
rename(file:changes)
}
// process after 5 minutes without any changes to the folder
watchman.setCommitDelay(5 * 60 * 1000)
println "Waiting for events"
console.readLine() // keep running and watch for changes