Jump to content

Changing the Prefix of a Group of Files


Recommended Posts

Guest W. Watson
Posted

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?

--

Wayne Watson (Nevada City, CA)

 

Web Page: <speckledwithStars.net>

  • Replies 6
  • Created
  • Last Reply
Guest Pegasus \(MVP\)
Posted

Re: Changing the Prefix of a Group of Files

 

 

"W. Watson" <wolf_tracks@invalid.com> wrote in message

news:C2Hri.25205$RX.4437@newssvr11.news.prodigy.net...

>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?

> --

> Wayne Watson (Nevada City, CA)

>

> Web Page: <speckledwithStars.net>

 

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.

Guest W. Watson
Posted

Re: Changing the Prefix of a Group of Files

 

Thanks. I'll give it a try. I didn't know these old tricks were still

around. :-)

 

Pegasus (MVP) wrote:

> "W. Watson" <wolf_tracks@invalid.com> wrote in message

> news:C2Hri.25205$RX.4437@newssvr11.news.prodigy.net...

>> 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?

>> --

>> Wayne Watson (Nevada City, CA)

>>

>> Web Page: <speckledwithStars.net>

>

> 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.

>

>

 

--

Wayne Watson (Nevada City, CA)

 

Web Page: <speckledwithStars.net>

Guest W. Watson
Posted

Re: Changing the Prefix of a Group of Files

 

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_%

 

 

W. Watson wrote:

> Thanks. I'll give it a try. I didn't know these old tricks were still

> around. :-)

>

> Pegasus (MVP) wrote:

>> "W. Watson" <wolf_tracks@invalid.com> wrote in message

>> news:C2Hri.25205$RX.4437@newssvr11.news.prodigy.net...

>>> 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?

>>> --

>>> Wayne Watson (Nevada City, CA)

>>>

>>> Web Page: <speckledwithStars.net>

>>

>> 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.

>>

>>

>

 

--

Wayne Watson (Nevada City, CA)

 

Web Page: <speckledwithStars.net>

Guest Sid Elbow
Posted

Re: Changing the Prefix of a Group of Files

 

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).

 

 

 

 

W. Watson wrote:

> 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?

Guest Pegasus \(MVP\)
Posted

Re: Changing the Prefix of a Group of 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%

 

"W. Watson" <wolf_tracks@invalid.com> wrote in message

news:bTIri.435$IE5.273@newssvr17.news.prodigy.net...

> 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_%

>

>

> W. Watson wrote:

>> Thanks. I'll give it a try. I didn't know these old tricks were still

>> around. :-)

>>

>> Pegasus (MVP) wrote:

>>> "W. Watson" <wolf_tracks@invalid.com> wrote in message

>>> news:C2Hri.25205$RX.4437@newssvr11.news.prodigy.net...

>>>> 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?

>>>> --

>>>> Wayne Watson (Nevada City, CA)

>>>>

>>>> Web Page: <speckledwithStars.net>

>>>

>>> 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.

>>>

>>>

>>

>

> --

> Wayne Watson (Nevada City, CA)

>

> Web Page: <speckledwithStars.net>

Guest Steve Parry [MVP]
Posted

Re: Changing the Prefix of a Group of Files

 

In news:C2Hri.25205$RX.4437@newssvr11.news.prodigy.net,

W. Watson <wolf_tracks@invalid.com> wibbled

> 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?

 

--

Steve Parry MCP MVP

http://www.gwynfryn.co.uk


×
×
  • Create New...