• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How rename a Directory ?

 
Srinivasa Vallabha
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I want to rename a directory, i know using renameTo() method we have to create file objects all the files which are there in a directory to its destination and then we need to delete the old one. But my question is, there is any other way to do this ?
Please help me....
thankx
Srinivasa Vallabha
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Srinivasa,
A File object can point to a file or a directory. All methods will work regardless of which is used. Therefore, you can easily do the following:

and it will work!
Regards,
Manfred.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic