Need help in renumbering

A swapping-ground for Regular Expression syntax

Need help in renumbering

Postby deanloh » Thu Jun 08, 2006 3:01 pm

First of all I must say this is a marvelous piece of software. Keep up the good work.

I'm facing a challenge and I had trouble figure out how to use BRU to solve it. Here's the description of the problem.

I have couple of folders of JPGs, each are numbered from 1 to 24, i.e. 1.jpg, 2.jpg... 24.jpg

Say I need to merge files from 3 folders together, therefore I need to renumber the files in the other folders to 25.jpg, 26.jpg and all the way till 72.jpg.

That's not all, in order to make sure the files will be sorted by number, I have to add a 0 in front of single digit numbers, i.e. 01.jpg, 02.jpg, 03.jpg...

Second task is a very small issue since at most I will have only 9 files to rename manually, but I need to find an effective to use BRU to rename the other two batches of files by number.

How should I go about that?
deanloh
 
Posts: 1
Joined: Thu Jun 08, 2006 7:45 am

Postby AbteriX » Thu Jun 08, 2006 4:34 pm

Please test this on an copy of your folder/files

###############################

First run:

You have in the second folder
1.jpg
2.jpg

Regex match: (\d+)
Regex Replace: (\1)

Numbering(10) - Prefix - Start 25

You get
25(1).jpg
26(2).jpg

##################################

Second run:


Then you have
25(1).jpg
26(2).jpg

Regex match: (\d+)\(\d+\)
Regex Replace: \1

You get
25.jpg
26.jpg

--
AbteriX
 
Posts: 12
Joined: Sun Mar 12, 2006 4:24 pm

Postby Admin » Thu Jun 08, 2006 5:31 pm

Can't you just REMOVE the entire filename, and then create a new filename using the Autonumber facility? You can create a padded autonumber (to handle the 01, 02 situation), and for the second and third folders you just choose a different starting number.


Jim
Admin
Site Admin
 
Posts: 2343
Joined: Tue Mar 08, 2005 8:39 pm


Return to Regular Expressions