This comment by aeroxr1:
you can also call sourceFile.renameTo(newPath)
– aeroxr1
Commented Nov 12, 2020 at 11:03
Please see Reliable File.renameTo() alternative on Windows?
I just had this issue, where renameTo did not work in an Azure deployment. I tried moving a file from a mounted (SMB) folder to a local folder. Apparently, people have issues with it on windows too.