#1 2010-06-11 01:36

JohnnySH
Member
Registered: 2007-08-31
Posts: 11

Swap file name

Hi

I have my file names as so


Artist - Title

I would like to swap artist with title, like so.

Title - Artist


Is there any easy way to use renamer to swap content before and after my "-" in the file name

thanks

Offline

#2 2010-06-11 02:52

eR@SeR
Senior Member
From: Земун, Србија
Registered: 2008-01-23
Posts: 353

Re: Swap file name

Hi, it's possible. Use RegEx rule:

Expression: "(\w+) - (\w+)"
Replace: "$2 - $1"

Look at ReNamer: Examples of Regular Expressions topic for more info about RegEx...

or

Rearrange rule (beta version):

1) Rearrange: Split using delimiters "-", New pattern "$2 - $1" (skip extension)
2) CleanUp: Fix spaces (skip extension)

Without 2nd rule we have " Title - Artist ". Is it possible to have "Title - Artist" somehow?


TRUTH, FREEDOM, JUSTICE and FATHERLAND are the highest morale values which human is born, lives and dies for!

Offline

#3 2010-06-11 03:28

JohnnySH
Member
Registered: 2007-08-31
Posts: 11

Re: Swap file name

Thank you so much

all worked fine


well done for such a great program

Offline

#4 2010-06-11 12:48

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,379

Re: Swap file name

eR@SeR wrote:

Without 2nd rule we have " Title - Artist ". Is it possible to have "Title - Artist" somehow?

Use " - " as a delimter (with spaces around the dash), then you won't need to use cleanup rule.

Also, it is safer to use "exact pattern of delimiters" option, in case the filename is like "Title - Artist - Album" so the last part will remain in the filename as opposed to be truncated if "delimiters" option is used.

Offline

#5 2010-06-11 18:07

eR@SeR
Senior Member
From: Земун, Србија
Registered: 2008-01-23
Posts: 353

Re: Swap file name

Great, thanks smile

...in case the filename is like "Title - Artist - Album"...

@JohnnySH
If you want that Album (or whatever) remain on 3rd position use this:

1) Rearrange: Split by delimiters " - ", New pattern "$2 - $1 - $3" (skip extension)

Title - Artist - Album --> Artist - Title - Album


TRUTH, FREEDOM, JUSTICE and FATHERLAND are the highest morale values which human is born, lives and dies for!

Offline

#6 2010-06-11 20:26

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,379

Re: Swap file name

eR@SeR, you might have missed the point of "exact pattern of delimiters" option.

What if filename contains 3 or 4 or 5 or even 10 dashes? When using "delimiters" there is always a possibility of loosing parts of the filename and that's why we made "exact pattern of delimiters" option. Try it with filenames which contain many dashes in the name and you'll see what I'm talking about.

P.S. Maybe this should be added to Wiki as a warning note.

Offline

#7 2010-06-12 02:58

eR@SeR
Senior Member
From: Земун, Србија
Registered: 2008-01-23
Posts: 353

Re: Swap file name

I know what you've talked about. First I used:

1) Rearrange: Split by exact pattern of delimiters " - ", New pattern "$2 - $1 - $3" (skip extension)

and get from "Title - Artist - Album" ---> "Artist - Album - Title - "    not desired
then

1) Rearrange: Split by delimiters " - ", New pattern "$2 - $1 - $3" (skip extension)

"Title - Artist - Album" --> "Artist - Title - Album" desired

1) Rearrange: Split by exact pattern of delimiters " - ", New pattern "$2 - $1$3" (skip extension)

"Title - Artist - Album" ---> "Artist - Album - Title" not desired (Album is on 2nd place)

Only because of results I used "delimiters" instead "exact pattern of delimiters".
How to get desired result using "exact pattern of delimiters"...and also if we have 4 or 5 words for ex. "Artist - Title - Album - Year - Genre" to swap first three words (combination is irrelevant) but other two to be intact. Sorry I don't get these things very well sad
That explanation could be added to Wiki Rearrange_Examples as warning note too.
Thanks in advance wink


TRUTH, FREEDOM, JUSTICE and FATHERLAND are the highest morale values which human is born, lives and dies for!

Offline

#8 2010-06-12 16:10

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,379

Re: Swap file name

With "exact pattern of delimiters" you basically define how many parts you want the filename to be split into. If you specify 1 delimiter that you end up with exactly 2 parts, if you specify 2 delimiters then 3 parts, and so on.

> Rearrange: Split by exact pattern of delimiters " - ", " - ", New pattern "$2 - $1 - $3" (skip extension)

Input: Title - Artist - Album
Output: Artist - Title - Album

Offline

Board footer

Powered by FluxBB