Code: Select all
FOR /r "D:\A B C" %%f in (*.m4a) do MOVE /-Y "%%f" "D:\X Y Z"
PAUSE
The purpose of this code is to seek out all .m4a files, regardless of their names, move them from "D:\A B C" to "D:\X Y Z" which it does all of that very well.
The issue is that, without the "/-Y" to stop it, it will automatically overwrite files of the same name. Is there a way to get it to just automatically rename the files with duplicate names (instead of just overwriting them with with no prompt) in order to prevent them from being overwritten? For example, I'd really like it if, when it runs into, say for example, File.mp3, File.mp3, and File.mp3 (Three different files, same name), it just renames them as File(1).mp3, File(2).mp3, and File(3).mp3. If anyone can provide a way to do this, I will be so grateful.