You need to use a for loop and tokenize the name. In your example try:
For /f “tokens=1,2,3,4 delims=_” %d in (‘dir /b /ad *’) do @echo ren
%d_%e_%f_%f_%g %d_YourStuff_%f_g
Once everything looks correct remove the echo to execute. If you put it into a
batch file you’ll need to use %% instead of %.
--
There are 10 kinds of people in the world...
those who understand binary and those who don't.
From: [email protected] [mailto:[email protected]] On
Behalf Of Bambi J Saastad
Sent: Wednesday, November 4, 2015 5:33 AM
To: [email protected]
Subject: [NTSysADM] Rename Directories
Hoping for some help with renaming directories
I had hoped to just use the move command but I get syntax errors....
The directories are named in this manner
AL1030004_502010109H_20151102_163916
I need to replace the middle 502010109H with OutProcessedABS
so it would become
AL1030004_OutProcessedABS_20151102_163916
I think I need to instead use a for loop, but I cannot get that syntax right
either
Any quick suggestions?
Thx
B?
-----------------------------
Bambi Saastad
office 952-402-7888
cell 612-963-1478