Changing the Prefix of a Group of Files

  • Thread starter Thread starter W. Watson
  • Start date Start date
W

W. Watson

I have some photos on a CD and they are prefixed like:

425691-R-284-1
425691-R-284-2
425691-R-284-3
425691-R-284-4
....
425691-R-284-24


I'd like to change the 425691-R-284- part to Trip2004_
Can it be done in one fell swoop?
 
W. Watson said:
I have some photos on a CD and they are prefixed like:

425691-R-284-1
425691-R-284-2
425691-R-284-3
425691-R-284-4
...
425691-R-284-24


I'd like to change the 425691-R-284- part to Trip2004_
Can it be done in one fell swoop?

You could do it by running this batch file from within the
folder where your files reside:

@echo off
dir /b 42*.* > c:\temp.txt
for /F %%a in (c:\temp.txt) do call :Sub %%a
del c:\temp.txt
goto :eof

:Sub
set old=%1
set new=%old:425691-R-284-=Trip2004_%
echo ren %old% %new%

Remove the word "echo" in the last line to activate the batch file.
 
Whoops. I slipped up slightly. The prefix is more like:
425691-R-284-1
425691-R-293-2
425691-R-244-3
425691-R-262-4
That is, the 3 digit number after R- varies while the last digit is the
sequence number of the photo. So maybe I need something like:
set new=%old:425691-R-...-=Trip2004_%
 
What I use for this (and a host of other renaming tasks) is Jim
Wilsher's Bulk Rename Utility from:

http://www.bulkrenameutility.co.uk/Main_Intro.php

It's extremely flexible. Hard to imagine any renaming jobs it couldn't
cope with.

Freeware ..... donate if you wish.

I'd suggest you keep sufficient of the original file name (say the
sequential number) to allow you to relate any modified files back to
their original versions. (I'm assuming that you save an original before
processing the files).
 
This is not a slight slip-up - it's a major difference that
changes the whole concept of the rename process.

@echo off
dir /b 425691-R*.* > c:\temp.txt
for /F %%a in (c:\temp.txt) do call :Sub %%a
del c:\temp.txt
goto :eof

:Sub
set old=%1
set new=Trip2004_%old:~14%
echo ren %old% %new%
 
In
W. Watson said:
I have some photos on a CD and they are prefixed like:

425691-R-284-1
425691-R-284-2
425691-R-284-3
425691-R-284-4
...
425691-R-284-24


I'd like to change the 425691-R-284- part to Trip2004_
Can it be done in one fell swoop?

Not on a CD they can't .... unless it's a re writable one?
 
Back
Top