hello, i have an exsting file in my HDD and i want rename this file.
you don't need path ??
Mercer
2010-05-10 15:56:19
sorry i don't see correctly
Mercer
2010-05-10 15:56:46
What on earth do you mean?
SLaks
2010-05-10 16:04:07
+1
A:
You may look at commons-io FileUtils.moveFile. That method tries File.renameTo
, and if that fails, tries to copy&delete the file (e.g. when moving from one drive to another).
If you use File.renameTo
directly (which should suffice if you only want to rename a file in the same directory), make sure you evaluate the returned boolean value!
Christian Semrau
2010-05-10 21:59:41