Reputation: 717
I want to rename files in a directory using this command :
for /r %%x in (*.ath) do ren "%%x" *.txt
The problem is if the filename already exists, the file is not replaced. Is there a simple way to delete the old file and then rename the new one ? Thanks
Upvotes: 0
Views: 6225
Reputation: 31251
To elaborate on @Ben's comment use
for /r %%x in (*.ath) do move "%%x" "%%~nx.txt" /y
Upvotes: 2