일부 하위 폴더를 제외하고 입력 폴더의 모든 하위 폴더를 outputDir에 복사하려고합니다. 복사에 사용하는 방법은 여기에 있습니다. 하지만 하위 폴더를 필터링하는 방법을 모르겠습니다.java의 일부 하위 폴더를 제외하고 모든 하위 폴더를 하나에서 다른 폴더로 복사 하시겠습니까?
public static void copyDirectory(String inputFolder, String outputDir) {
File source = new File(inputFolder);
File desc = new File(outputDir);
ArrayList al=new ArrayList();//contains all your directory filter names
try {
for (File file : source.listFiles()) {
if (!al.contains(file.getName())&&file.isDirectory()) {
FileUtils.copyDirectory(source, desc);
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
가능한 DUP http://stackoverflow.com/questions/7191635/java-copy-a-folder-excluding-some-internal-file –
이를 참조하십시오 http://stackoverflow.com/questions/7191635/java-copy-a-folder-exclu-some-internal-file –