jQuery in Action, 3rd edition
The moose likes Java in General and the fly likes Rename a directory in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Rename a directory in Java" Watch "Rename a directory in Java" New topic

Rename a directory in Java

Rob Bass
Ranch Hand

Joined: Aug 28, 2001
Posts: 67
Hello all,
I tried renaming a single directory using java.io.File renameTo and that worked, but when I added subdirectories it no longer worked?? Anyone know an easy way to do the above?
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
Which part no longer worked? Can you show us the code that you used?

"JavaRanch, where the deer and the Certified play" - David O'Meara
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1873
hi Rob,
replying to ur post after long...
well, i created dir hierarchy as,
i used following code and it worked for me,

hope it works for u as well. make sure u dont have a file with the same dir name in any case.
I agree. Here's the link: http://aspose.com/file-tools
subject: Rename a directory in Java
It's not a secret anymore!