aspose file tools*
The moose likes Java in General and the fly likes File renameTo not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "File renameTo not working" Watch "File renameTo not working" New topic

File renameTo not working

jin sun
Ranch Hand

Joined: Feb 16, 2005
Posts: 30
This is frustrating, I had it working a while ago but now it isn't working. The renameTo is returning false but I deleted the file with the same name that I'm trying to rename and closed the output and input streams. I also checked the permissions. Anyone have a clue what I'm doing wrong? Thanks in advance.

[ June 20, 2005: Message edited by: jin sun ]
Miguel Roque
Ranch Hand

Joined: Oct 24, 2002
Posts: 126

A couple of months ago a friend have asked for my help in a similar situation. The renameTo was not working and the problem was on the file path as he was trying to rename with only the file name. Try to include the complete path for the file, for example,

jin sun
Ranch Hand

Joined: Feb 16, 2005
Posts: 30
Ohhh ok, thanks a lot Miguel.
I agree. Here's the link:
subject: File renameTo not working
Similar Threads
Write a new Line
close() method; I/O class chaining
I/O code exception
reverse the text file and write