Franklin Flesher's ques: How to rearrange filename parts

Advanced Renamer forum
#1 : 05/12-24 22:18
Delta Foxtrot
Posts: 364
Franklin Flesher's original message:

Please help! How would I do it to rearrange a name like this:

current
mov_2024_12_02_top_freeze_mica_agent

desired
mica_agent_top_freeze_mov_2024_12_02

-----------------------------------------------------------------
My first answer:
New name method:
<Word:7>_<Word:8>_<Word:5>_<Word:6>_<Word:1>_<Word:2>_<Word:3>_<Word:4>

EDIT:
Or Replace method:
Replace: ^(\w+)_(\w+)_(\w+)_(\w+)_(\w+)_(\w+)_(\w+)_(\w+)
Replace with: $7_$8_$5_$6_$1_$2_$3_$4
Regular expressions CHECKED

As I said on the other thread, I suspect this won't be the end of the conversation. That's because, if you have other files in your Files list that don't exactly fit that pattern you are going to mess up their names. For instance, if you had a file like "mov_2024_12_02_top_freeze_mica", the Replace method won't work at all and the New name method gives a weird result.

If you want to provide a *representative* sample of your filenames, with target filenames, we can make a stab at getting you a more useful answer across the range of your filenames. Or if this works for you, great! :)

Best,
DF

edited: 05/12-24 22:53
#2 : 06/12-24 19:25
Franklin Flesher
Posts: 2
Reply to #1:
You are right. Depending on the length of the file name it will mess things up
I have found the to work when the artist is a single word.

Replace method
Text to be replaced : (\w*)_(\w*)
Replace with : \2 \1
reg expressions checked

Swap
Separator: _
Occurrence: 4th
Apply to: Name

Replace method again
Test to be replaced : (\w*)_(\w*)
Replace with: \2 - \1
Occurrence : 1st
Use regular expressions

Replace
Text to be replaced: _
Replace with: space

New Case
Set upper case first letter in every word

SO . . .This RD_2022_1_2_House_Tunes_Ricardo, becomes Ricardo - House Tunes RD 2022 1 2

So I would to see if there is some way to make this "RD_2020_3_2_Tropical_Breeze_Dan_Marks" become "Dan Marks - Tropical Breeze RD 2020 3 2" when the artist name is 2 words




#3 : 06/12-24 20:35
Delta Foxtrot
Posts: 364
Reply to #2:

Hi Franklin,

Well, this will work with one- or two word names, but again only if the title is two words. You've sort of painted yourself into a corner by using one single character (underscore in this case) to divide everything in your filenames. Anyway, one replace method:

Replace: "^([^_]+)_(\d+)_(\d+)_(\d+)_([^_]+)_([^_]+)_([^_]+)(_?)(\w*)?" (leave out quotes)
With: $7$8$9 - $5_$6_$1_$2_$3_$4
Regex: CHECKED

I suspect you were on the right track by using cascading methods. Maybe try something like first moving just the date to the back, then the RD part (what is that anyway?), then deal with the various permutations of artist and title. If you use separate methods for various number of words in artist and title, and make sure they fail to change anything unless the rule applies *exactly* to the words in question, you'll be golden. But without a representative sample of filenames I can't give you much more guidance than that.

Best,
DF