• Post Reply Bookmark Topic Watch Topic
  • New Topic

Copying Directories

 
Asuthosh Borikar
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 193
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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()
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!