replace names then autonumbering

A swapping-ground for Regular Expression syntax

replace names then autonumbering

Postby bensonave » Mon Oct 13, 2008 6:39 pm

I am NOT a programmer, but need to rename about several thousands of jpg files. it is becoming a big challenge for me, can someone provide some help, all files are jpg.

Here are the file names:
0550-00BU.jpg
0550-01.jpg
0550-01_Feature.jpg
0550-01BK.jpg

1250-02.jpg
1250-02BK.jpg
1250-02_Feature.jpg
1250-02BU.jpg
1250-02_Open.jpg
1250-02_Pen.jpg


And the end result should look like:

1001.jpg
1002.jpb
1002_1_.jpg
1002_2_.jpg

1003.jpg
1003_1_.jpg
1003_2_.jpg
1003_3_.jpg
1003_4_.jpg
1003_5_.jpg
1003_6_.jpg


I have an excel file to match up
0550-00.jpg 1001.jpg
0550-01.jpg 1002.jpg
1250-02.jpg 1003.jpg
......

But how can I do the rest of the renaming?

Peter
bensonave
 
Posts: 5
Joined: Fri Oct 10, 2008 7:21 pm
Location: California

Re: replace names then autonumbering

Postby jimwillsher » Mon Oct 13, 2008 7:05 pm

If your excel file contains ALL the pairs then you're fine, just import the whole lot. If not, try using the "prevent duplicates" menu option. You won't see the true picture until youa ctually rename the files, but it should add the _1, _2 suffixes.


Jim
jimwillsher
 
Posts: 63
Joined: Wed Sep 24, 2008 1:22 pm

Re: replace names then autonumbering

Postby bensonave » Tue Oct 14, 2008 11:43 pm

Hi Jim,

Thanks for your email.

I do not have the list matching up the names exactly. As I load the matching pair file, remove the extra letters on the old file names. It will not work

I tried, and found out BRU Process the file first, then cut out the extra letters which is too late to rename according to the matching up file.

I have spent all day trying different setting, now I am very frustrated and all confused. My hair will be all gone very soon.

Peter
bensonave
 
Posts: 5
Joined: Fri Oct 10, 2008 7:21 pm
Location: California

Re: replace names then autonumbering

Postby GMA » Wed Oct 15, 2008 9:59 am

Arghh... Hi, Peter; I can't achieve exactly what you need, but pretty close. There's a way to convert your filenames to this:

1000.jpg
1001.jpg
1001_1_.jpg
1001_2_.jpg

1002.jpg
1002_1_.jpg
1002_2_.jpg
1002_3_.jpg
1002_4_.jpg
1002_5_.jpg


You get 1000 instead of 1001, 1001 instead of 1002, etc. I know that's not what you asked, but I'll tell you the how-to anyway, just in case you don't really care about that difference. First of all, make sure "Options > Prevent Duplicates" is checked. Then you have to do two passes:

FIRST PASS:

- Set RegEx (1) to:

    MATCH: (.*)-(..)(.*)
    REPLACE: \2
- Set Add (7) to:

    Prefix: 10
- Press "Rename".

SECOND PASS:

- Set RegEx (1) to:

    MATCH: (.*)_(.*)
    REPLACE: \1_\2_
- Press "Rename".

------------------------------------------------------------------------

Best regards,
Gabriel.
GMA
 
Posts: 91
Joined: Sun Dec 02, 2007 1:30 pm
Location: Argentina

Re: replace names then autonumbering

Postby GMA » Thu Oct 16, 2008 6:29 am

I was cheking the post and saw something in your first sentence that I missed before: you say "several thousands". I must warn you (if you decide to use my method above): if all of those files are in the same folder, you're gonna have to do a few more steps. The thing is, the numbering starts from "xxxx-00yyyy.jpg", and, at a certain point, you'll probably reach "xxxx-99yyyy.jpg".
But, what number comes next? (maybe is 00 again instead of 100, but with a different number at "xxxx") Tell me that before renaming anything because you need different operations for the files going from:

"xxxx-00yyyy.jpg" to "xxxx-99yyyy.jpg"
"xxxx-100yyyy.jpg" to "xxxx-999yyyy.jpg"
"xxxx-1000yyyy.jpg" to "xxxx-9999yyyy.jpg"

You're going to need a maximum of 4 renamings if you have less than 9999 files (because the "SECCOND PASS" you can do it just once). But I can't tell you what you should use until you tell me what happends after 99, 999, etc.

Best regards,
Gabriel.
GMA
 
Posts: 91
Joined: Sun Dec 02, 2007 1:30 pm
Location: Argentina


Return to Regular Expressions