Why File::moveFileTo() not work?

Hi,everyone,
I have a file in
c:\Users\leon\AppData\Local\Temp\Low\Music\track1.wav,
I set this path as juce::String, oldPath

and I have a destination at
c:\Music, and I want to move and rename track1.wav to song1.wav.
I set this path as juce::String newPath , it is c:\Music\song1.wav

I use the moveFileTo() method as follows:

juce::File oldFile(oldPath);
juce::File newFile(newPath);
oldFile.moveFileTo(newFile);
This should move to the oldFile to desired location , and rename
it to song1.wav. However, it do not work.
Anybody can help me?

Best
Leon

These are some of the scenarios where moveFileTo has failed in my code

  1. No write/ access permission in the destination location.
  2. Invalid file name.
  3. File already existed and i didn’t have permission to delete it
  4. Check the destination path and see if exists.

You could also try copyfileto and delete the old file