renaming extensions on files with underscores
Posted: 05 May 2013 13:53
Hi, normally I never run into issues like this, but recently I came across some file extensions that I want to rename that include underscores, this is really irritating as the usual command I use in my batch files doesn't even print an error.
Example File:
AS_Barrel01.AG
I want to rename it to:
AS_Barrel01.back
I want this to be done to the entire directory and sub-directories if they exist.
Here's what I usually use: cd /d "C:\Folder" for /f "tokens=* delims= " %%a in ('dir /b /ad /s') do rename "%%a\*.AG" "*.back"
As I mentioned this is completely ineffective with these particular files. I tried variants like *_*.AG but it didn't work, I guess it isn't that simple.
Example File:
AS_Barrel01.AG
I want to rename it to:
AS_Barrel01.back
I want this to be done to the entire directory and sub-directories if they exist.
Here's what I usually use: cd /d "C:\Folder" for /f "tokens=* delims= " %%a in ('dir /b /ad /s') do rename "%%a\*.AG" "*.back"
As I mentioned this is completely ineffective with these particular files. I tried variants like *_*.AG but it didn't work, I guess it isn't that simple.