A question about bulk renaming files.

Bulk Rename Utility How-To's

A question about bulk renaming files.

Postby maysobano » Thu May 11, 2023 1:32 pm

I have a bunch of files which I'd like to rename. Currently they're like foo_0001_bar.jpg, foo_0002_bar.jpg etc. and I want to rename them to 0001.jpg, 0002.jpg etc.
The numbers aren't always the same number of characters, so there may be a foo_57_bar.jpg, but the stuff I want rid of is all the same.

I've googled somewhat, but most of the examples are about changing file extensions or other non-relevant aspects. I thought of ls'ing them into a file, then turning it into a script to mv them one by one, but there must be a quicker way.

Suggestions?
maysobano
 
Posts: 1
Joined: Thu May 11, 2023 1:18 pm

Re: A question about bulk renaming files.

Postby therube » Thu May 11, 2023 5:59 pm

Getting the number is easy enough.
Padding the number, I'm not sure about? (Javascript renaming should be able to do it, though.)

To get the number...

1:RegEx:, enable Simple
Code: Select all
Match:  %1_%2_%3
Replace:  %2
therube
 
Posts: 1319
Joined: Mon Jan 18, 2016 6:23 pm

Re: A question about bulk renaming files.

Postby therube » Thu May 11, 2023 6:17 pm

If ordering does not (particularly) matter, & you simply want a sequentially numbered list of file names,
you could:

2:Name, Remove

10:Numbering, Mode: Prefix, Start: 1, Incr: 1, Pad: 4


If order does matter, then 57 vs 0001, kind of thing, would throw things out of wack.
therube
 
Posts: 1319
Joined: Mon Jan 18, 2016 6:23 pm


Return to How-To