filename swap how to do it?

Bulk Rename Utility How-To's

filename swap how to do it?

Postby heartradiousa » Fri Jun 05, 2020 6:00 pm

I need to take this file name 1. Song Title-Artist Name-Album Title.mp3 and do the followng
1. i need to remove the number and period, this number could be 2 digits sometimes
2. Move the Artist Name to the front
3. Put a space with a dash between the artist name and song title like this "Artist Name - Song Title
4. Delete the Album Title

so the final out put reads like this Artist Name - Song title.mp3
heartradiousa
 
Posts: 19
Joined: Thu Mar 01, 2018 11:38 pm

Re: filename swap how to do it?

Postby therube » Wed Jun 10, 2020 8:53 pm

1:RegEx
Code: Select all
Match:  ^(\d{1,2}\.\s)(.*?)-(.*?)-
Replace:  \3 - \2

1 or 2 digits, followed by a (dot) & (space) [number+period]
anything else, up to a (dash, non-greedy) [song title]
anything else, up to a (dash, non-greedy) [artist name]
[ignore all else]

Pick & choose the parts you want & rearrange as wanted.

Code: Select all
1. Song Title-Artist Name-Album Title.mp3 ->
Artist Name - Song Title.mp3



(Note: would break on a name that includes a hypen...)
Code: Select all
01. Here Comes The King-X-Ray Dog-Canis Rex II.mp3 ->
X - Here Comes The King.mp3
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm

Re: filename swap how to do it?

Postby heartradiousa » Sat Jun 13, 2020 3:03 pm

I could not get it to execute here is the string - Yesterday Today And Forever-Vicky Beeching-wow worship aqua.mp3

should be Vickey Beeching - Yesterday Today And Forever-Vicky Beeching
heartradiousa
 
Posts: 19
Joined: Thu Mar 01, 2018 11:38 pm

Re: filename swap how to do it?

Postby therube » Sat Jun 13, 2020 4:49 pm

Well, what you seemed to be asking for, yesterday (beginning with 1 or 2 numbers...), is different from what you're wanting today.

1:RegEx
Code: Select all
Match:  (.*?)-(.*?)-
Replace:  \2 - \1

Code: Select all
Yesterday Today And Forever-Vicky Beeching-wow worship aqua.mp3 ->
Vicky Beeching - Yesterday Today And Forever.mp3


Not clear if you wanted Vicky Beeching duplicated in there?
If so, change the Replace: \2 - \1 - \2
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm

Re: filename swap how to do it?

Postby heartradiousa » Sat Jun 13, 2020 6:49 pm

thanks It worked
heartradiousa
 
Posts: 19
Joined: Thu Mar 01, 2018 11:38 pm

Re: filename swap how to do it?

Postby heartradiousa » Sat Jun 13, 2020 9:14 pm

I have been using the following script to flip my song title and artist name based upon the hyphen but the the scrip I have been using is not working

3) song title-artist name.mp3 to artist name - song title.mp3
Match: (.*?)(\s-\s)(.*)
Replace: \3\2\1

it not working for the following examples

Joy To The World-Neil Diamond.mp3
Different Wings-TransSiberian Orchestra.mp3

the finished product does need a space on each side of the hyphen like Joy To The World - Neil Diamond.mp3

thanks
heartradiousa
 
Posts: 19
Joined: Thu Mar 01, 2018 11:38 pm

Re: filename swap how to do it?

Postby therube » Sat Jun 13, 2020 10:53 pm

Your Match says to look for a dash separated by spaces, (\s-\s), yet your examples do not have that, so nothing is matched.

You can always add wanted spaces into the Replace:, \s.)
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm

Re: filename swap how to do it?

Postby heartradiousa » Mon Jun 15, 2020 9:11 pm

I finally got my renaming project done
am needing a script to make every first letter a capital like in the following example
Neil Diamond - White Christmas.mp3

I also need it to correct the spacing in the dash/hyphen as in example 2

Neil Diamond - White Christmas.mp3 should be Neil Diamond - White Christmas.mp3
also it might be
Neil Diamond- White Christmas.mp3 should be Neil Diamond - White Christmas.mp3
heartradiousa
 
Posts: 19
Joined: Thu Mar 01, 2018 11:38 pm


Return to How-To