Andreamary
asked on
Finding correct regular expression to batch rename 130 files
I am using Adobe Bridge to batch rename 130 files in a folder. It can handle regular expressions, so I am looking for the correct expression to achieve the following:
Original filename formats:
127155aaaa_58_Road to Cottage Lake Black.jpg
001000_Cottage Map.jpg
Description of revised filename:
Starting from left of entire filename -- Retain first 3 numbers of original filename
Starting from the left of '.jpg' file extension -- retain all text and spaces to left, up to and including the first instance of "_"
Retain ".jpg" file extension
Desired filename after batch renaming:
127_Road to Cottage Lake Black.jpg
001_Cottage Map.jpg
I hope I've provided enough details.
Thanks,
Andrea
Original filename formats:
127155aaaa_58_Road to Cottage Lake Black.jpg
001000_Cottage Map.jpg
Description of revised filename:
Starting from left of entire filename -- Retain first 3 numbers of original filename
Starting from the left of '.jpg' file extension -- retain all text and spaces to left, up to and including the first instance of "_"
Retain ".jpg" file extension
Desired filename after batch renaming:
127_Road to Cottage Lake Black.jpg
001_Cottage Map.jpg
I hope I've provided enough details.
Thanks,
Andrea
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
For some reason my comment didn’t show up, so I’ll write it again...
You’re solution works perfectly, Dan - thanks very much!
Cheers,
Andrea
You’re solution works perfectly, Dan - thanks very much!
Cheers,
Andrea
Easy to do in PERL.
In Adobe... Whew... Likely best to rename each file with a set of regular expressions, each rename pruning cruft, till only your desired text remains in each file.
Complex.
I'd personally use PERL + have it work the first time.