Retrieving Files Recursively in Java

Sometimes I need to read recursively all the files from a directory. I kept using DirectoryScanner class from the Apache(located in ant.jar in my case). It has the advantage that it can filter through files based on the well-known asterisk matching. Recently I had to look-up in a directory containing lots and lots of files and it proved DirectoryScanner tended to be quite slow. So I used plain java for that(using java.io.File and java.io.FilenameFilter classes), for 2 reasons. First is that the speed can be improved quite easy. The second reason is that reporting progress in command line give the impression it takes less time.
Continue reading