Renaming Bulk Files with different delimiters and length

Bulk Rename Utility How-To's

Renaming Bulk Files with different delimiters and length

Postby ron0023 » Thu Oct 19, 2023 6:47 am

Hello, I am new here and I would like to rename this bulk files to organize them

sample:

0004-00-12345-4_LAT TEST NAME_341587_1_F
0005-00-12345-1-DELA TEST NAME JR-129050_1_F
0004-00-12345-1-CAS TEST MALE OR CAS TEST
0007-00-12345-8_HAR TEST NAME_393272_1_F
0007-00-123456-8_TOMBOY TEST NAME_299290_1_F
1234567890__DAY TEST NAME_395195_1_F
1234567__TEST NAME PSSI_329199_1_F
1234567_TEST NAME PSSI_329199_1_F
FEMALE-393087_OR 393091_1_F
GER-0106-00-12345-7_LANT_TEST_NAME_69735_1_F

and I want the output to be like this

0004-00-12345-4_LAT TEST NAME_341587_1_F
0005-00-12345-1_DELA TEST NAME JR_129050_1_F
0004-00-12345-1_CAS TEST MALE OR CAS TEST
0007-00-12345-8_HAR TEST NAME_393272_1_F
0007-00-123456-8_TOMBOY TEST NAME_299290_1_F
1234567890_DAY TEST NAME_395195_1_F
1234567_TEST NAME PSSI_329199_1_F
1234567_TEST NAME PSSI_329199_1_F
FEMALE-393087 OR_393091_1_F
GER-0106-00-12345-7_LANT TEST NAME_69735_1_F

Is therea way to make this possible?
ron0023
 
Posts: 3
Joined: Thu Oct 19, 2023 6:34 am

Re: Renaming Bulk Files with different delimiters and length

Postby Luuk » Thu Oct 19, 2023 12:58 pm

First would have to describe why "OR 393091" should be separated differently than the others ??
Luuk
 
Posts: 706
Joined: Fri Feb 21, 2020 10:58 pm

Re: Renaming Bulk Files with different delimiters and length

Postby ron0023 » Fri Oct 20, 2023 1:38 am

Luuk wrote:First would have to describe why "OR 393091" should be separated differently than the others ??


Sorry for the wrong input of delimiter that one should be like the others

FEMALE-393087_OR 393091_1_F
ron0023
 
Posts: 3
Joined: Thu Oct 19, 2023 6:34 am

Separate delimiters with "_" & remove "_" inside of de_limit

Postby Luuk » Fri Oct 20, 2023 4:39 am

This is probably over-complicated, because its to only match formats like in the examples.
So with RegEx(1) having a checkmark inside for "v2", the "Match" and "Replace" can be like...

^(\d+(-\d+)*|[A-Z]+(-\d+)+)[- _]+([A-Z]+([ _][A-Z]*)*?)[- _]*(\d+_1_F|$)$(?X)(\G|\|)[^_]+\K_(?=.*:)/g(?X)([|:])(?!$)/g(?X):/g
$1|$4:$6(?X) (?X)_(?X)

If needing a description for how this conducts, I can colorize and give the description in a few days.
Hope it helps!
Luuk
 
Posts: 706
Joined: Fri Feb 21, 2020 10:58 pm

Re: Renaming Bulk Files with different delimiters and length

Postby ron0023 » Fri Oct 20, 2023 8:27 am

Thanks for the reply, but can you elaborate? Like will this all going to be part of the match

Match: ^(\d+(-\d+)*|[A-Z]+(-\d+)+)[- _]+([A-Z]+([ _][A-Z]*)*?)[- _]*(\d+_1_F|$)$(?X)(\G|\|)[^_]+\K_(?=.*:)/g(?X)([|:])(?!$)/g(?X):/g
$1|$4:$6(?X) (?X)_(?X)

or is there some part of it that is going to be in the Replace?
ron0023
 
Posts: 3
Joined: Thu Oct 19, 2023 6:34 am


Return to How-To