我正在尝试将文件从不同计算机中的文件夹复制到同一本地目标文件夹。
/*Example there are 3 network folders mapped.
A: 192.168.10.1\folderA
B: 192.168.10.2\folderB
E: 192.168.10.3\folderC
*/
//Getting the image files from their folders respectively
//(E.g. 1.png, 2.png, 3.png)
String source1 = "A:/1.png";
String target1 = "C:\\Users\\user\\Desktop\\1.png"
String source2 = "B:/2.png";
String target2 = "C:\\Users\\user\\Desktop\\2.png"
String source3 = "E:/3.png";
String target3 = "C:\\Users\\user\\Desktop\\3.png"
try{
Files.copy(Paths.get(source1), Paths.get(target1),
StandardCopyOption.REPLACE_EXISTING);
Files.copy(Paths.get(source2), Paths.get(target2),
StandardCopyOption.REPLACE_EXISTING);
Files.copy(Paths.get(source3), Paths.get(target2),
StandardCopyOption.REPLACE_EXISTING);
}catch(IOException e){
e.getMessage();
}
所以source1已成功复制,但不是2和3,为什么会这样?