Help renaming folders with regular expression

Advanced Renamer forum
#1 : 23/11-20 03:41
Brandon Clark
Brandon Clark
Posts: 5
I am organizing my studio's archives and am looking to rename 1000's of folders that all have the same formatting structure. I am mildly familiar with regular expressions but have been able to get this formatted in a better way after trying for hours on end. Any help would be greatly appreciated. Willing to clarify any aspect which may be tricky to understand. I will include the expression I've come up with after hours of trying below. Thank you!

----->this is the farthest I've gotten: (.*)_(\d\d)(\d\d)_(\d\d)_(\d\d)_([^\.]*)

-----------------
EXPLANATION
-----------------

RAW File Name:
SOURCE_(YEAR)-(TITLE)-(TITLE)-(SUBJECT/MODEL)-(BY)-(PHOTOGRAPHER NAME)_(SN)_(RES)

EXAMPLES:
GettyImages_2020-01-01_A-DAY-WITH-{MODELNAME1}-{MODELNAME2}-IN-THE-STUDIO-{MODELFIRSTNAME}-{MODELLASTNAME}-BY-{PHOTOGNAME1}-{PHOTOGNAME2}_51d25_high
GettyImages_2020-01-01_MODELNAME-1-{MODELNAME}-BY-{PHOTOGNAME}_51d25_high
GettyImages_2020-01-01_MODELNAME-2-{MODELNAME}-BY-{PHOTOGNAME}_51d25_high
APImages_2020-01-01_LOCATION-TEST-{MODELNAME}-BY-{PHOTOGNAME}_51d25_high
WireImage_2020-01-01_LOCATION-TEST-{MODEL1NAME}-{MODEL2NAME}-and{MODELNAME1}-BY-{PHOTOG1NAME}-{PHOTOG2NAME}_51d25_high


Everything between the date and serial number at the end will always be different from folder to folder.
The only constant is "-" used in place of spaces and "by". Sometimes the model goes by one name, as does the photographer. Sometimes there is no model name in the title. Sometimes there are two models. It is confusing, i know!

The format I'm trying to achieve is:

GettyImages - YEAR-MO-DAY - TITLE TITLE TITLE - MODEL NAME BY PHOTOG NAME
(the serial number and res can be removed)

So:
"GettyImages_2020-01-01_A-DAY-WITH-{MODELNAME1}-{MODELNAME2}-IN-THE-STUDIO-{MODELFIRSTNAME}-{MODELLASTNAME}-BY-{PHOTOGNAME1}-{PHOTOGNAME2}_51d25_high"
would become
"GettyImages- 2020-01-01 - A DAY WITH {MODELNAME1} {MODELNAME2} IN THE STUDIO - {MODELFIRSTNAME} {MODELLASTNAME} BY {PHOTOGNAME1} {PHOTOGNAME2}"

APImages_2020-01-01_LOCATION-TEST-{MODELNAME}-BY-{PHOTOGNAME}
would become
APImages - 2020-01-01 - LOCATION TEST - {MODELNAME} BY {PHOTOGNAME}


23/11-20 03:41
#2 : 23/11-20 19:20
David Lee
David Lee
Posts: 600
Assuming that your examples are properly explicit then this should do it.

There may be a simpler method but this solution requires 3 methods...

1) Replace method (to remove SN & RES)...
Replace: ".*}\K_[^_]*_[^_]*$"
With: <leave blank>

2) Replace method (to replace hyphens with spaces - except in date)...
Replace: "-(?!\d)"
With: <space>

Check "Use regular expressions" for both Replace methods

3) List Replace method (two lines)
a) Replace: "_" With: " - " (ie <space><hyphen><space>)
b) Replace "and" With "and " (ie add trailing space)





23/11-20 19:20