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! 


 

What did you think of this article?




Trackbacks
  • No trackbacks exist for this post.
Comments
  • No comments exist for this post.
Leave a comment

Submitted comments are subject to moderation before being displayed.

 Enter the above security code (required)

 Name

 Email (will not be published)

 Website

Your comment is 0 characters limited to 3000 characters.