Long running tasks follow up - copying files
As a follow up to my recent blog posting on long running tasks, here is an example of using the mini-framework described in that post to copy files from one directory to another:
The code above refers to two methods of a "FileUtils" class. The "listAllFilesUnder" method, which returns a List<File> containing all files (not directories) under a given directory and its sub-directories, is shown below:

This method, in turn, refers to a method named "listAllContentsUnder" in FileUtils:

The "FileUtils.copyFile" method, which uses Java NIO, is shown below:
And here is the (obligatory) screenshot showing the progress bar in action:
Enjoy!

Comments