2

Possible Duplicate:
Copying files from one directory to another in Java
Copy entire directory contents to another directory?

How can i copy a directory in java?

Example I want dir A to be copied

from src\A to dest

Final folder structure should be

 dest\A.
Community
  • 1
  • 1
user1053279
  • 95
  • 2
  • 4

3 Answers3

4

You could use Apache Commons IO (v2.1). It includes a FileUtils which provides that method for you.

FileUtils.copyDirectory(src,dest)

FileUtils.html#copyDirectory(java.io.File, java.io.File)

Brambo
  • 807
  • 7
  • 12
2

This should help you: How to copy directory in Java

Andrei Sfat
  • 7,924
  • 4
  • 43
  • 67
0

Files.copy(source + "/" + folderName, target + "/" + folderName, REPLACE_EXISTING);

shift66
  • 11,440
  • 11
  • 47
  • 78