File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes Copying Directories Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Reply Bookmark "Copying Directories" Watch "Copying Directories" New topic
Author

Copying Directories

Asuthosh Borikar
Ranch Hand

Joined: Sep 29, 2000
Posts: 75
Hi,
I need to write some code to copy all the contents(including sub directories and files) of one directory to another directory.
I've tried using File.renameTo(), but, this method 'moves' the contents rather than copying them. Can some one please point me to a good algorithm of iterating thru the contents of a directory, and copying them to another? Thanks a lot.
-Asuthosh.
Graeme Brown
Ranch Hand

Joined: Oct 13, 2000
Posts: 193
If there are a limited number of O/S that you need to run this on, you would probably be better making a call to the operating system commands using Runtime.exec()
 
 
subject: Copying Directories
 
Threads others viewed
Copying Directories
Plugin autoloading
Installation of j2me apps
How to copy empty sub-directory?
JSP Eclipse pblm
developer file tools