Page 1 of 1
How to swap and delete a field in a file name?
Posted:
Fri Jun 05, 2020 9:38 pm
by heartradiousa
I need an expression 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
Re: How to swap and delete a field in a file name?
Posted:
Sat Jun 06, 2020 4:27 am
by RegexNinja
For the example given, this expression does it:
^\d{1,2}\. *([A-Z][^-]+)-([A-Z][^-]+)-[A-Z][^-]+$
\2 - \1
Beware: It removes any/all text after a 2nd-hyphen (if beginning with Uppercase), use with caution.
Song-Titles or Artist-Names with hyphens in them would spell disaster.
As a minor precaution, it wont touch names with more than 2-hyphens.
Re: How to swap and delete a field in a file name?
Posted:
Sat Jun 06, 2020 1:18 pm
by heartradiousa
it is not working here is a sample
1. My Praise-Phillips, Craig & Dean-let your glory fall.mp3
this should now read after the rename
Phillips, Craig & Dean - My Praise.mp3
the third field -let your glory fall is the album title i need removed
Re: How to swap and delete a field in a file name?
Posted:
Sat Jun 06, 2020 1:59 pm
by RegexNinja
For the 2-examples given, this expression does it:
^\d{1,2}\. *([A-Z][^-]+)-([A-Z][^-]+)-[A-Za-z][^-]+$
\2 - \1
Re: How to swap and delete a field in a file name?
Posted:
Sat Jun 06, 2020 2:51 pm
by heartradiousa
this is working for some but like it did not work either of the following examples
Step By Step-Rich Mullins-songs .mp3 or Step By Step - Rich Mullins - songs .mp3 (notice this spaces in the dashs)
Re: How to swap and delete a field in a file name?
Posted:
Sat Jun 06, 2020 3:41 pm
by RegexNinja
Per the last 2-examples, leading-digits are no longer mandatory.
For the 4-examples given, this expression does it:
^(?:\d{1,2}\. )*([A-Z][^-]+?) *- *([A-Z][^-]+?) *- *[A-Z a-z][^-]+$
\2 - \1
Results:
1. My Praise-Phillips, Craig & Dean-let your glory fall ----> Phillips, Craig & Dean - My Praise
1. Song Title-Artist Name-Album Title ---------------------> Artist Name - Song Title
Step By Step-Rich Mullins-songs ----------------------------> Rich Mullins - Step By Step
Step By Step - Rich Mullins - songs -------------------------> Rich Mullins - Step By Step
Re: How to swap and delete a field in a file name?
Posted:
Sat Jun 06, 2020 6:18 pm
by heartradiousa
I understand what your saying its working with most but not for all here is an example that did not work what change just curious?
5. It Is Well With My Soul-Avalon-faith- a hymns collection [bonus track].mp3
Re: How to swap and delete a field in a file name?
Posted:
Mon Jun 08, 2020 8:36 pm
by trm2
You have not been abandoned. RegexNinja wanted me to let you know that if he is not responding, he is having serious internet problems and does know when
they will be resolved. Hopefully another contributor will step in and answer your questions.
Re: How to swap and delete a field in a file name?
Posted:
Fri Jun 26, 2020 9:44 pm
by heartradiousa
I have completed my project except for the following So I need a scrip to look for the group of numbers in the bracket and they need to be removed Sanctus Real - On Fire [1592226] to have the final output look like this Sanctus Real - On Fire can you please assist
I have gotten my Project completed and this is the final step and wish to thank every for all the help you you have given me we have sorted over 35,000 tracks of music.
thanks