Retrieving all filenames from hierarchical directories using Apache Commons IO
Listing of file names in hierarchical directories can be done recursively as demonstrated in the previous recipe. However, this can be done in a much easier and convenient way and with less coding using the Apache Commons IO library.
In order to perform this recipe, we will require the following:
- In this recipe, we will be using a Java library from Apache named Commons IO. Throughout the book, we will be using version 2.5. Download the JAR file of your choice from here: https://commons.apache.org/proper/commons-io/download_io.cgi
- Include the JAR file in your project an external JAR in Eclipse.
How to do it...
- Create a method that takes the root directory in ...