File content[] = new File("C:/FilesToGo/").listFiles();
for (int i = 0; i < content.length; i++){
String destiny = "C:/Kingdoms/"+content[i].getName();
File desc = new File(destiny);
try {
Files.copy(content[i].toPath(), desc.toPath(), StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) {
e.printStackTrace();
}
}
これは私が持っているものです。それはすべてをうまくコピーします。ただし、コンテンツの中にはいくつかのフォルダーがあります。フォルダはコピーされますが、フォルダの内容はコピーされません。