This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes Move File from one directory to another Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Move File from one directory to another " Watch "Move File from one directory to another " New topic
Author

Move File from one directory to another

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Hi ,

I am trying to move File from one directory to another directory using renameTo Option , but i am always getting false as the return type , with no Exception .



Please help


Save India From Corruption - Anna Hazare.
Paul Clapham
Sheriff

Joined: Oct 14, 2005
Posts: 19719
    
  10

Presumably C:\Two already exists (perhaps it's actually the directory you wanted to move the file to), so you can't rename C:\One\sai.txt to that. Did you actually want to rename it to C:\Two\sai.txt? If so then do that.
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Move File from one directory to another
 
jQuery in Action, 3rd edition