Tech Support Guy banner
Status
Not open for further replies.
1 - 2 of 2 Posts

·
Retired Trusted Advisor
Joined
·
19,935 Posts
I would just use a file rename utility. There are plenty of them out there. Yes it can be done natively with a dos batch file but why write one for a one shot deal. As long as you just want the character after the underscore changed to a 2 on all files it would be easy enough to do with a batch file.

I use a program called V-The File Viewer to accomplish this task though. Would take me all of 5 seconds.
 

·
Retired Trusted Advisor
Joined
·
19,935 Posts
I think this should work. Just whipped it out real quick.
Code:
@echo off
TITLE Re-name Filenames

:: Set _iFolder to the folder name with all your files.  Don't put your batch file here.
set _iFolder=C:\pathtofiles

pushd "%_iFolder%"

:: change to the appropriate file extension or just put in an asterisk
FOR /F "tokens=1* Delims=_" %%A IN ('dir /b /a-d N341_00702202*.txt') DO (
	rename "%%A"_"%%B"  "%%A"_2"%%B"
	)
popd
 
1 - 2 of 2 Posts
Status
Not open for further replies.
Top