可能重複:
Copying files from one directory to another in Java
Copy entire directory contents to another directory?如何在java中複製目錄?
我怎樣才能在Java中複製一個目錄?
例子我想dir將一個被複制
from src\A to dest
最後的文件夾結構應該是
dest\A.
可能重複:
Copying files from one directory to another in Java
Copy entire directory contents to another directory?如何在java中複製目錄?
我怎樣才能在Java中複製一個目錄?
例子我想dir將一個被複制
from src\A to dest
最後的文件夾結構應該是
dest\A.
你可以使用Apache Commons IO (v2.1)。它包括爲您提供該方法的FileUtils
。
FileUtils.copyDirectory(SRC,目標寄存器)
Files.copy(source + "/" + folderName, target + "/" + folderName, REPLACE_EXISTING);