Files.Copy在linux中使用Java抛出java.nio.file.NoSuchFileException

时间:2015-03-15 17:28:57

标签: java linux file-copying

public void copyFiles(){
    File source = new File("/home/anil/FileLocation/Source/test1.text");
    File destination = new File("/home/anil/FileLocation/Destination/"+ source.getName());

    try {
        Files.copy(source.toPath(), destination.toPath(), StandardCopyOption.REPLACE_EXISTING);
    } catch (IOException e) {
        System.out.println(e);
    }
}

0 个答案:

没有答案