Board index Scripting and Automation [CODE] FolderWatchService

[CODE] FolderWatchService

Running FileBot from the console, Groovy / FileBot scripting, shell scripts, etc

Post 21 Jul 2012, 10:37
rednoah User avatar
The Source

Posts: 2080
Location: 北京

Here's a basic example for watching folders for new files. It'll just print the added/changed files.

// watch folders and print files that were added/modified (requires Java 7)
def watchman = args.watch { files ->
   println files
}

// process after 500ms without any changes to the folder
watchman.commitDelay = 500        // default = 5min
watchman.commitPerFolder = true   // default = true

println 'Waiting for changes'
console.readLine() // keep running and watch for changes
FileBot is free software. Please help support FileBot by writing a review or considering a donation.
Image

Return to Scripting and Automation

cron