Copying the middle of the filename to the beginning

Bulk Rename Utility How-To's

Copying the middle of the filename to the beginning

Postby will26 » Fri Jul 28, 2023 11:34 am

how to copy part of the filename to the beginning?

ie files are named like this:

FGT_86_74_4500_ME_Riser.pdf
FGT_55_74_4501_ME_Duct.pdf
FGT_50_74_4502_ME_Shaft.pdf

i would like to copy the four digit number 4500, 4501 etc to the start so the files are named as:

4500_FGT_86_74_4500_ME_Riser.pdf
4501_FGT_55_74_4501_ME_Duct.pdf
4502_FGT_50_74_4502_ME_Shaft.pdf

This will enable the files to be sorted by their code in windows explorer.

I have over two thousand PDF files to sort through, so any help on this would be much appreciated!
will26
 
Posts: 1
Joined: Fri Jul 28, 2023 11:26 am

Re: copying the middle of the filename

Postby therube » Fri Jul 28, 2023 4:28 pm

If they're all laid out the same, with the 4-digit number being the 4th "field", then:

1:RegEx, enable Simple
Code: Select all
Match:  %1_%2_%3_%4_%5
Replace:  %4 --- %1_%2_%3_%4_%5

(I've included --- only to distinguish.
In this case %4 is the 4th field.
Also %5 matches the 5th field & all that follows.
You could change match to: %1_%2_%3_%4_%5_%6 if you wanted to split the 5th & 6th field out, separately.)

Code: Select all
Youtube_2009-06-01_TITLE-PERSON-A-by-INGRET_62bd5_high
->   62bd5 --- Youtube_2009-06-01_TITLE-PERSON-A-by-INGRET_62bd5_high

FGT_86_74_4500_ME_Riser.pdf
->   4500 --- FGT_86_74_4500_ME_Riser.pdf

Note that any file name that matches the Match: will be renamed, not just ones with "4-digits".
therube
 
Posts: 1319
Joined: Mon Jan 18, 2016 6:23 pm


Return to How-To