Question
Pegasystems Inc.
JP
PEGA
Posted: Sep 12, 2018
Last activity: Feb 17, 2021
Last activity: 17 Feb 2021 10:12 EST
Closed
Solved
How to rename a file using FileUtils?
How do we rename a file using FileUtils?
Tried using Move twice by using a temporary file and location, but I am worried about failure in moving the file second time, as it will leave back the temporary file, which is not good.
Any thoughts?
You do not need to apply Move twice. You can simply specify new name in the same location and it will do the rename.
Be aware that file operations may throw exceptions, so, don't forget to wrap it with Try-Catch.