我想复制一个文件夹
c:\data
按原样放入C:\Users\Matthew\AppData\Local\Temp。
所以路径应该是
C:\Users\Matthew\AppData\Local\Temp\data
这是我到目前为止所掌握的
public void copyToTemp(File source){
try {
File dest = File.createTempFile(source.getName(), null);
FileUtils.copyDirectory(source, dest);
//change the source folder to the temp folder
SOURCE_FOLDER = dest.getAbsolutePath();
} catch (IOException e) {
e.printStackTrace();
}
}发布于 2014-10-24 06:04:07
您可以使用标准java.nio.file.Files.copy(Path source, Path target, CopyOption... options)。请参阅here
https://stackoverflow.com/questions/26538153
复制相似问题