* @throws IOException
*/
public static void copyRecursively(String from, String to, boolean overwrite) throws IOException {
- copyRecursively(from, to, overwrite, null);
+ copyRecursively(from, to, overwrite, new File [0]);
}
/**
private static void copyRecursivelyWithoutDirChecking(File fromDir, File toDir, boolean overwrite, File... filters) throws IOException {
HashSet<String> filterSet = new HashSet<String>();
- for(File filter: filters) {
- filterSet.add(filter.getCanonicalPath());
+
+ if(filters != null) {
+ for(File filter: filters) {
+ filterSet.add(filter.getCanonicalPath());
+ }
}
+
Stack<File> fromFileStack = new Stack<File>();
Stack<File> toFileStack = new Stack<File>();
}
else if(fromFile.isFile()) {
if(!toFile.exists() || !toFile.isFile() || overwrite) {
- boolean found = false;
- if(filters != null) {
- if(filterSet.contains(fromFile.getCanonicalPath())) {
- found = true;
- break;
- }
- }
- if(!found) {
+ if(filterSet.size() == 0 || !filterSet.contains(fromFile.getCanonicalPath())) {
copyTo(fromFile, toFile, false);
}
}