I have a folder with this structure
mainFolder
--Sub1
--File .scl
--File .awl
--Other files
--Sub2
--Fi
I think the ugliness comes from introducing ignoreFile()
, which necessarily loses some of the useful information (which strings actually matter, which strings are file extensions, etc.) Additionally, that array is going to be created for every file in your hierarchy, which is extremely inefficient. Consider something like this, instead:
FileUtils.copyDirectory(srcDir, dstDir, new FileFilter() {
public boolean accept(File pathname) {
// We don't want 'Sub3' folder to be imported
// + look at the settings to decide if some format needs to be
// excluded
String name = pathname.getName();
if (!Settings.getSiemensOptionAWL() && name.endsWith(".awl"))
return false;
if (!Settings.getSiemensOptionSCL() && name.endsWith(".scl"))
return false;
return !(name.equals("Sub3") && pathname.isDirectory());
}
}, true);