Batch renaming files

Zom

Zom

Associate
Joined
18 Oct 2002
Posts
1,117
I have a whole load of files that I want to rename. Basically I want to remove the first 8 characters from the start of the file name. Does anyone know of any utilities that could do this for me?
 
That's a toughie... It's easy to add characters to the end of filenames, as in
ren *.* *xxx.*
but removing characters I've never done... Can you give us a screenshot of the filenames in that folder? Is the rest of the filename after the first 8 digits identical in all the files?
 
assuming all the files look like this:
"12345678abcd.jpg"


then this batch will strip the first 8 chars and rename the file:


strip.bat
-----------------------------------
cd c:\pron

for %%J in (*.JPG) do call :sub %%J

:sub
SET STRING=%1
SET STRING=%STRING:~8,15%
ECHO String: %1 -- %STRING%
ren %1 %STRING%
-----------------------------------


I'm not totally happy with this, but it appears to work OK.
(...tweakers welcome!)

let me know how it works for you :)

.
 
Back
Top Bottom