Renaming a file in Java without using renameTo()
Posted
by Hristo
on Stack Overflow
See other posts from Stack Overflow
or by Hristo
Published on 2010-01-06T16:50:55Z
Indexed on
2010/05/14
16:04 UTC
Read the original article
Hit count: 212
Disregarding my last post, I've found the source of the problem. I'm using
a.renameTo(b)
when b doesn't exist. The reason it doesn't exist is because there is a symbolic link so if b is "/usr/name/folder/file", then b really is "/mnt/MountTest" because the symlink is to that directory.
So the question is, is there an alternative way to rename a file in Java using a string value? If not, how can this rename procedure be done differently?
© Stack Overflow or respective owner