Looks to me like there are five sections to that name, not four. You can either
adjust accordingly to add a fifth section, or if the piece you’re replacing is
always the 2nd one, try doing tokens=1,2,* and then just use %d, %e, and %f as
pre, mid, post sections and replace the mid section.
--
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 9:08 AM
To: ntsysadm <[email protected]>
Subject: Re: [NTSysADM] Rename Directories
Then it's highly probable that my syntax is still wrong
HEre is a screen shot of my command and the result.
[Inline image 1]
-----------------------------
Bambi Saastad
office 952-402-7888
cell 612-963-1478
On Wed, Nov 4, 2015 at 7:58 AM, James Rankin
<[email protected]<mailto:[email protected]>> wrote:
Ah yes, thought that’s what you were driving at, sorry
Ren command worked fine on a directory in my test
From: [email protected]<mailto:[email protected]>
[mailto:[email protected]<mailto:[email protected]>]
On Behalf Of Bambi J Saastad
Sent: 04 November 2015 13:55
To: ntsysadm <[email protected]<mailto:[email protected]>>
Subject: Re: [NTSysADM] Rename Directories
I thought that was only when in the batch file
B
-----------------------------
Bambi Saastad
office 952-402-7888<tel:952-402-7888>
cell 612-963-1478<tel:612-963-1478>
On Wed, Nov 4, 2015 at 7:47 AM, James Rankin
<[email protected]<mailto:[email protected]>> wrote:
Extra % needs to go in front of all the %x statements
From: [email protected]<mailto:[email protected]>
[mailto:[email protected]<mailto:[email protected]>]
On Behalf Of Bambi J Saastad
Sent: 04 November 2015 13:22
To: ntsysadm <[email protected]<mailto:[email protected]>>
Subject: Re: [NTSysADM] Rename Directories
Thanks, this almost worked. I added the % in front of the last g
For /f “tokens=1,2,3,4 delims=_” %d in (‘dir /b /ad *’) do @echo ren
%d_%e_%f_%f_%g %d_OutProcessedABS_%f_%g
WIth echo I got
ren AL1030004_502010109H_20151102_20151102_163916
AL1030004_OutProcessedABS_20151102_163916
So echoing works
I tried removing echo and got The system cannot find the file specified, and I
believe that is because it is a directory not a file. I tried move and got the
same error
B
-----------------------------
Bambi Saastad
office 952-402-7888<tel:952-402-7888>
cell 612-963-1478<tel:612-963-1478>
On Wed, Nov 4, 2015 at 6:26 AM, Melvin Backus
<[email protected]<mailto:[email protected]>> wrote:
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]>
[mailto:[email protected]<mailto:[email protected]>]
On Behalf Of Bambi J Saastad
Sent: Wednesday, November 4, 2015 5:33 AM
To: [email protected]<mailto:[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<tel:952-402-7888>
cell 612-963-1478<tel:612-963-1478>