This content has been marked as final. Show 7 replies
you can think of considering FileUtils in commons-io.jar from apache commons.
Do this one throw exception if the move fails?
Because in File.renameTo() only return false but didnt throw any error why it fails.
That's correct, it doesn't throw exceptions. java.nio.files.Files throws exceptions. Note that File.renameTo() won't move a file across filesystems, only rename within or between directories on the same file system.
So you mean it's better to use the apache?
So you mean ...No, I don't mean ...
Whenever, and I do mean whenever, I see a question that starts like that, the answer is invariably 'no'.
This time is no exception.
I haven't said one single word about Apache.
here is the API
Give it a shot and see if it full fills all your needs if it doesn't try something else.
Surely you mean moveFileToDirectory(), although it is hard to make much sense of statements like this: 'createDestDir - If true create the destination directory, otherwise if false throw an IOException'.