I need to find files in directories and subdirectories by type of extension and ignorecase mode, this is my code:
String[] patron = {"doc", "xls", "ppt"};
Iterator iter = FileUtils.iterateFiles(new File(directories), patron, true);
I also need to return the files with extension like Doc, Doc, ... ignorecase
You must refer the documentation of FileUtils at http://commons.apache.org/proper/commons-io/javadocs/api-1.4/org/apache/commons/io/FileUtils.html
The definition you are using
Allows iteration over the files in a given directory (and optionally its subdirectories) which match an array of extensions. This method is based on listFiles(File, String[], boolean).
extensions - an array of extensions, ex. {"java","xml"}. If this parameter is null, all files are returned.recursive - if true all subdirectories are searched as well
it should return files irrespective of doc or DOc or dOC they are all same.Else there is one more definition given where you can apply filters.
You can use this definition for iterateFiles
In this you have to pass an IOFileFilter object, you can implement the given accept method definition
The documentation of IOFileFilter can be found at http://commons.apache.org/proper/commons-io/javadocs/api-1.4/org/apache/commons/io/filefilter/IOFileFilter.html