Difference between revisions of "ReNamer:Rules:Rearrange"

From den4b Wiki
Jump to navigation Jump to search
Line 1: Line 1:
[[Image:RearrangeRule.png|center]]
+
[[Image:RearrangeRule.png|center]]  
  
This rule allows you to chop up the existing file name and reuse any/all of the parts in any order to compose a new name.
+
This rule allows you to chop up the existing file name and reuse any/all of the parts in any order to compose a new name.  
*You can also add your own text, or use meta tags while composing the new name.
+
 
 +
*You can also add your own text, or use meta tags while composing the new name.  
 +
*You can also use the whole original name, and insert literal text or meta tags before and/oit.<br>
  
 
The parameters are as follows:  
 
The parameters are as follows:  
Line 8: Line 10:
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Parameter:
+
! Parameter:  
 
! How to use:
 
! How to use:
 
|-
 
|-
Line 15: Line 17:
 
Specifies how to split the existing name into parts.  
 
Specifies how to split the existing name into parts.  
  
* You can use only one of the two options at a time (you cannot combine the chopping methods)<br>
+
*You can use only one of the two options at a time (you cannot combine the chopping methods)<br>
  
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Option:
+
! Option:  
 
! What it does:
 
! What it does:
 
|-
 
|-
Line 30: Line 32:
 
*Spaces, numbers and symbols are treated like normal characters.  
 
*Spaces, numbers and symbols are treated like normal characters.  
 
*Several delimiters can be used at a time. Use the &#124; character to separate them.  
 
*Several delimiters can be used at a time. Use the &#124; character to separate them.  
*The chopped parts are numbered from left, as $1, $2, $3, etc.  
+
*The chopped parts are numbered from left, as $1, $2, $3, etc.
*If the delimiter occurs at the very beginning of the name, the resultant $1 contains nothing (because thereis nothing on the left side of the delimiter).
+
 
 +
:The same parts can be referred from the end as $-1, $-2, $-3, etc.
 +
 
 +
*If the delimiter occurs at the very beginning of the name, the resultant $1 contains nothing (because there is nothing on the left side of the delimiter).
 +
 
 
|-
 
|-
 
| Positions  
 
| Positions  
Line 40: Line 46:
 
*Spaces, numbers and symbols are treated like normal characters.  
 
*Spaces, numbers and symbols are treated like normal characters.  
 
*No part of the original name is omitted during chopping.  
 
*No part of the original name is omitted during chopping.  
*You can enter multiple positions. Separate them with the &#124; character.
+
*You can enter multiple positions. Separate them with the &#124; character.  
*The chopped parts are numbered from left, as $1, $2, $3, etc.  
+
*The chopped parts are numbered from left, as $1, $2, $3, etc.
 +
 
 +
:The same parts can be referred from the end as $-1, $-2, $-3, etc.
 +
 
 
|}
 
|}
  
Line 53: Line 62:
  
 
|-
 
|-
| [[Image:PlusButton.png]]
+
| [[Image:PlusButton.png]]  
 
| Adds a &#124; character between two delimiter entries, and separates them. <br>(You can directly type the '''&#124;''' character instead of clicking on this button.).
 
| Adds a &#124; character between two delimiter entries, and separates them. <br>(You can directly type the '''&#124;''' character instead of clicking on this button.).
 
|-
 
|-
| New pattern
+
| New pattern  
 
|  
 
|  
 
How to compose the new name from the parts created from the original name (see above).  
 
How to compose the new name from the parts created from the original name (see above).  
  
*You can add meta tags and literal text wherever you want.
+
*You can add meta tags and literal text wherever you want.
 +
*$0 refers to the whole original name. This allows you to quickly compose a new name by inserting a string at the beginning and/or end.
  
 
|-
 
|-
 
| [[Image:ReNamer Insert Meta Tag Button.png]]  
 
| [[Image:ReNamer Insert Meta Tag Button.png]]  
| Click the button to see a list of [[ReNamer:Meta_Tags|meta-tags]]. Select any meta tag to insert it in the new name template.
+
| Click the button to see a list of [[ReNamer:Meta Tags|meta-tags]]. Select any meta tag to insert it in the new name template.
 
|}
 
|}
  
Line 71: Line 81:
 
For simplicity's sake, we have split the uses in two parts:  
 
For simplicity's sake, we have split the uses in two parts:  
  
# '''Basic uses''' (typical needs of beginners)  
+
#'''Basic uses''' (typical needs of beginners)  
# '''Advanced uses''' (for the power users)
+
#'''Advanced uses''' (for the power users)
 
 
== Basic uses  ==
 
 
 
=== Example 1  ===
 
 
 
 
'''Task:''' Switch the words, and remove the comma between them.  
 
'''Task:''' Switch the words, and remove the comma between them.  
  
 
{| class="wikitable"
 
{| class="wikitable"
! From:
+
|-
 +
! From:  
 
! To:
 
! To:
 
|-
 
|-
| King, Stephen
+
| King, Stephen  
| Stephen King  
+
| Stephen King
 
|-
 
|-
 
| Cook, Robin  
 
| Cook, Robin  
| Robin Cook  
+
| Robin Cook
 
|-
 
|-
 
| Pride and Prejudice, The  
 
| Pride and Prejudice, The  
| The Pride and Prejudice  
+
| The Pride and Prejudice
 
|}
 
|}
  
Line 105: Line 111:
  
 
{| class="prettytable"
 
{| class="prettytable"
! From:
+
|-
 +
! From:  
 
! To:
 
! To:
 
|-
 
|-
Line 123: Line 130:
  
 
{| class="wikitable"
 
{| class="wikitable"
! From:
+
|-
 +
! From:  
 
! To:
 
! To:
 
|-
 
|-
 
| 01 - Afilename.zip  
 
| 01 - Afilename.zip  
| Afilename.zip  
+
| Afilename.zip
 
|-
 
|-
| 002 - Bfilename.zip
+
| 002 - Bfilename.zip  
 
| Bfilename.zip
 
| Bfilename.zip
 
|-
 
|-
 
| 0003 - Cfilename.zip  
 
| 0003 - Cfilename.zip  
| Cfilename.zip  
+
| Cfilename.zip
 
|}
 
|}
  
Line 147: Line 155:
 
#The '''Delete''' rule also would work (in ''right-to-left ''mode). But the '''Rearrange''' rule also allows you to add any string to the truncated names.
 
#The '''Delete''' rule also would work (in ''right-to-left ''mode). But the '''Rearrange''' rule also allows you to add any string to the truncated names.
  
=== Example 4 ===
+
=== Example 4 ===
  
 
'''Task: '''Move the first part to the end.  
 
'''Task: '''Move the first part to the end.  
  
 
{| class="wikitable"
 
{| class="wikitable"
! From:
+
|-
 +
! From:  
 
! To:
 
! To:
 
|-
 
|-
Line 165: Line 174:
 
New Order: $2.$3.$4.$1<br>  
 
New Order: $2.$3.$4.$1<br>  
  
=== Example 5 ===
+
=== Example 5 ===
  
 
'''Task: '''Move the artist's name from end to the beginning, and change the name format.  
 
'''Task: '''Move the artist's name from end to the beginning, and change the name format.  
  
 
{| class="wikitable"
 
{| class="wikitable"
! From:
+
|-
 +
! From:  
 
! To:
 
! To:
 
|-
 
|-
| Ring ring_ABBA.mp3
+
| Ring ring_ABBA.mp3  
 
| ABBA - Ring Ring.mp3
 
| ABBA - Ring Ring.mp3
 
|-
 
|-
| Material girl_Madonna.mp3
+
| Material girl_Madonna.mp3  
 
| Madonna - Material girl mp3
 
| Madonna - Material girl mp3
 
|}
 
|}
Line 191: Line 201:
  
 
{| class="wikitable"
 
{| class="wikitable"
! From:
+
|-
 +
! From:  
 
! To:
 
! To:
 
|-
 
|-
| DSC_0001-1.jpg
+
| DSC_0001-1.jpg  
 
| 1-DSC_0001.jpg
 
| 1-DSC_0001.jpg
 
|-
 
|-
| DSC_0001-2.jpg
+
| DSC_0001-2.jpg  
 
| 2-DSC_0001.jpg
 
| 2-DSC_0001.jpg
 
|-
 
|-
| DSC_0001-10.jpg
+
| DSC_0001-10.jpg  
 
| 10-DSC_0001.jpg
 
| 10-DSC_0001.jpg
 
|}
 
|}
Line 215: Line 226:
  
 
{| class="wikitable"
 
{| class="wikitable"
! From:
+
|-
 +
! From:  
 
! To:
 
! To:
 
|-
 
|-
 
| family_001.jpg  
 
| family_001.jpg  
| family_sent_001.jpg  
+
| family_sent_001.jpg
 
|-
 
|-
 
| work_023.jpg  
 
| work_023.jpg  
| work_sent_023.jpg  
+
| work_sent_023.jpg
 
|-
 
|-
 
| friend_098.jpg  
 
| friend_098.jpg  
| friend_sent_098.jpg  
+
| friend_sent_098.jpg
 
|}
 
|}
  
Line 243: Line 255:
  
 
{| class="wikitable"
 
{| class="wikitable"
! From:
+
|-
 +
! From:  
 
! To:
 
! To:
 
|-
 
|-
Line 258: Line 271:
 
'''Remarks:'''  
 
'''Remarks:'''  
  
# Note the space after the hyphen. If we use just a "-" as delimiter, the second token would be left with a space in front, which we will have to trim separately.  
+
#Note the space after the hyphen. If we use just a "-" as delimiter, the second token would be left with a space in front, which we will have to trim separately.  
# Even the '''Delete''' rule would have worked (in ''right-to-left ''mode). But the '''Rearrange''' rule also allows you to add any string to the new name.
+
#Even the '''Delete''' rule would have worked (in ''right-to-left ''mode). But the '''Rearrange''' rule also allows you to add any string to the new name.
  
 
=== Example 9  ===
 
=== Example 9  ===
Line 266: Line 279:
  
 
{| class="wikitable"
 
{| class="wikitable"
! From:
+
|-
 +
! From:  
 
! To:
 
! To:
 
|-
 
|-
| 08. Madonna - Like A Prayer.wma
+
| 08. Madonna - Like A Prayer.wma  
|rowspan="3"| Madonna - Like A Prayer.wma
+
| rowspan="3" | Madonna - Like A Prayer.wma
 
|-
 
|-
| 08.-Madonna - Like A Prayer.wma  
+
| 08.-Madonna - Like A Prayer.wma
 
|-
 
|-
| 08 Madonna - Like A Prayer.wma  
+
| 08 Madonna - Like A Prayer.wma
 
|}
 
|}
  
Line 287: Line 301:
 
We chose the string "Madonna" as delimiter because it does not occur anywhere else in the names. The unwanted characters on the left are assigned to token $1, which we will not omit in the new name. However, there is an undesired side-effect: ReNamer removes "Madonna" string from the token $2 because it is the delimiter. Therefore, we have to manually add that missing string "Madonna" to $2, to restore the names.  
 
We chose the string "Madonna" as delimiter because it does not occur anywhere else in the names. The unwanted characters on the left are assigned to token $1, which we will not omit in the new name. However, there is an undesired side-effect: ReNamer removes "Madonna" string from the token $2 because it is the delimiter. Therefore, we have to manually add that missing string "Madonna" to $2, to restore the names.  
  
=== Example 10 ===
+
=== Example 10 ===
  
 
'''Task:''' Move the number to front, and remove the square brackets.  
 
'''Task:''' Move the number to front, and remove the square brackets.  
  
 
{| class="wikitable"
 
{| class="wikitable"
! From:
+
|-
 +
! From:  
 
! To:
 
! To:
 
|-
 
|-
Line 307: Line 322:
 
'''Remarks:'''  
 
'''Remarks:'''  
  
# The | character is used to separate the two delimiters.  
+
#The | character is used to separate the two delimiters.  
# The second delimiter "|" will not produce a token. It is included only to remove it from the new name.
+
#The second delimiter "|" will not produce a token. It is included only to remove it from the new name.
  
=== Example 11 ===
+
=== Example 11 ===
  
'''Task:''' Add composer name and duration to an mp3 file, as prefix and suffix, respectively.
+
'''Task:''' Add composer name and duration to an mp3 file, as prefix and suffix, respectively.  
  
 
{| class="wikitable"
 
{| class="wikitable"
! From:
+
|-
 +
! From:  
 
! To:
 
! To:
 
|-
 
|-
 
| Eine kleine Nachtmusik.mp3  
 
| Eine kleine Nachtmusik.mp3  
| Mozart - Eine kleine Nachtmusik (6.37).mp3  
+
| Mozart - Eine kleine Nachtmusik (6.37).mp3
 
|-
 
|-
 
| Don Giovanni.mp3  
 
| Don Giovanni.mp3  
| Mozart - Don Giovanni (4.5).mp3  
+
| Mozart - Don Giovanni (4.5).mp3
 
|}
 
|}
  
Line 333: Line 349:
 
'''Remarks:'''  
 
'''Remarks:'''  
  
# This can also be done by using the '''Insert''' rule. However, you have to use that rule twice (once for prefix and the second time for the suffix). On the other hand, the '''Rearrange''' rule allows you to add both in a single stroke. Besides, you can see the structure of the new name.  
+
#This can also be done by using the '''Insert''' rule. However, you have to use that rule twice (once for prefix and the second time for the suffix). On the other hand, the '''Rearrange''' rule allows you to add both in a single stroke. Besides, you can see the structure of the new name.  
# When the original name is sliced at position 1, there is no characters on the left side; so the $1 token is a blank. The ''entire'' name is copied into the $2 token. This is a great trick to compose new name using the ''whole'' original name.
+
#When the original name is sliced at position 1, there is no characters on the left side; so the $1 token is a blank. The ''entire'' name is copied into the $2 token. This is a great trick to compose new name using the ''whole'' original name.
  
== Advanced uses ==
+
== Advanced uses ==
  
=== Example 1 ===
+
=== Example 1 ===
  
 
'''Task:''' Remove the string from the file name.  
 
'''Task:''' Remove the string from the file name.  
  
 
{| class="wikitable"
 
{| class="wikitable"
! From:
+
|-
 +
! From:  
 
! To:
 
! To:
 
|-
 
|-
| Artist - Title [Time 4 02 Cold] [2004].mpg
+
| Artist - Title [Time 4 02 Cold] [2004].mpg  
 
| Artist - Title [2004].mpg
 
| Artist - Title [2004].mpg
 
|}
 
|}
Line 358: Line 375:
 
'''Remarks:'''  
 
'''Remarks:'''  
  
# The '''|''' character separates the two delimiters.  
+
#The '''|''' character separates the two delimiters.  
# Notice that we have included spaces in the delimiters, so that they do not end up as part of the tokens.  
+
#Notice that we have included spaces in the delimiters, so that they do not end up as part of the tokens.  
# We have selected two ''different'' delimiters to represent the beginning and the end of the string we want to remove. Thus '''''whatever''''' lies between the two delimiters is converted into a token. This token is then omitted in the new name. This works just like using wildcards for the string (or a RegEx pattern).
+
#We have selected two ''different'' delimiters to represent the beginning and the end of the string we want to remove. Thus '''''whatever''''' lies between the two delimiters is converted into a token. This token is then omitted in the new name. This works just like using wildcards for the string (or a RegEx pattern).
  
=== Example 2 ===
+
=== Example 2 ===
  
 
'''Task:''' The file names contain artist name, album name and track name. Sort them into separate folders as follows:  
 
'''Task:''' The file names contain artist name, album name and track name. Sort them into separate folders as follows:  
  
# Create a separate folder for each artist.  
+
#Create a separate folder for each artist.  
# For each artist, create a subfolder for each album.  
+
#For each artist, create a subfolder for each album.  
# Move each file in the corresponding folder.
+
#Move each file in the corresponding folder.
  
 
{| class="wikitable"
 
{| class="wikitable"
! From:
+
|-
 +
! From:  
 
! To:
 
! To:
 
|-
 
|-
 
| Title - Artist (Album).mp3  
 
| Title - Artist (Album).mp3  
| D:\Artist\Album\Title.mp3  
+
| D:\Artist\Album\Title.mp3
 
|}
 
|}
  
Line 386: Line 404:
 
'''Remarks:'''  
 
'''Remarks:'''  
  
# Note that the delimiters contain spaces and symbols, so that only text remains in the tokens.  
+
#Note that the delimiters contain spaces and symbols, so that only text remains in the tokens.  
# The last delimiter ) does not produce a token. It is added just to strip the closing bracket from the last token.  
+
#The last delimiter ) does not produce a token. It is added just to strip the closing bracket from the last token.  
# Instead of '''D:''' a relative path (such as '''..\..\''') can be added to the front.
+
#Instead of '''D:''' a relative path (such as '''..\..\''') can be added to the front.
  
=== Example 3 ===
+
=== Example 3 ===
  
 
'''Task: '''Sort digital photos in different folders based on the '''Date taken''' for each photo.  
 
'''Task: '''Sort digital photos in different folders based on the '''Date taken''' for each photo.  
  
 
{| class="wikitable"
 
{| class="wikitable"
! From:
+
|-
 +
! From:  
 
! To:
 
! To:
 
|-
 
|-
 
| DSC_0001.jpg  
 
| DSC_0001.jpg  
| D:\photos\trip\2009_10_21\DSC_0001.jpg  
+
| D:\photos\trip\2009_10_21\DSC_0001.jpg
 
|-
 
|-
| DSC_0002.jpg
+
| DSC_0002.jpg  
| D:\photos\trip\2009_10_21\DSC_0002.jpg  
+
| D:\photos\trip\2009_10_21\DSC_0002.jpg
 
|-
 
|-
 
| DSC_0125.jpg  
 
| DSC_0125.jpg  
| D:\photos\trip\2009_10_25\DSC_0125.jpg  
+
| D:\photos\trip\2009_10_25\DSC_0125.jpg
 
|}
 
|}
  
Line 416: Line 435:
 
'''Remarks:'''  
 
'''Remarks:'''  
  
# Note that this EXIF data is contained in the meta tag of each photo, not in the file name.  
+
#Note that this EXIF data is contained in the meta tag of each photo, not in the file name.  
# The meta tag ''':EXIF_Date:''' is replaced by the actual '''date taken''' for each photo. Thus all photos taken on the same date will be moved to the same folder.  
+
#The meta tag ''':EXIF_Date:''' is replaced by the actual '''date taken''' for each photo. Thus all photos taken on the same date will be moved to the same folder.  
# The actual name of the folder would depend on the [[ReNamer:Program_settings#Meta_tags_settings|Date and Time format settings]].
+
#The actual name of the folder would depend on the [[ReNamer:Program settings#Meta_tags_settings|Date and Time format settings]].
  
=== Example 4 ===
+
=== Example 4 ===
  
 
'''Task:''' Delete the last part of the base name (but the extension should remain). Note that the file names have different lengths, so you cannot slice the name at a particular position. The names have a different depths also (number of segments separated by dots).  
 
'''Task:''' Delete the last part of the base name (but the extension should remain). Note that the file names have different lengths, so you cannot slice the name at a particular position. The names have a different depths also (number of segments separated by dots).  
  
 
{| class="wikitable"
 
{| class="wikitable"
! From:
+
|-
 +
! From:  
 
! To:
 
! To:
 
|-
 
|-
 
| title.text1.text2.extension  
 
| title.text1.text2.extension  
| title.text1.extension  
+
| title.text1.extension
 
|-
 
|-
 
| title.text1.text2.text3.extension  
 
| title.text1.text2.text3.extension  

Revision as of 02:59, 20 August 2009

RearrangeRule.png

This rule allows you to chop up the existing file name and reuse any/all of the parts in any order to compose a new name.

  • You can also add your own text, or use meta tags while composing the new name.
  • You can also use the whole original name, and insert literal text or meta tags before and/oit.

The parameters are as follows:

Parameter: How to use:
Split using

Specifies how to split the existing name into parts.

  • You can use only one of the two options at a time (you cannot combine the chopping methods)
Option: What it does:
Delimiter

Chop the name where the delimiter occurs.

  • The delimiter can be a single character or a string.
  • The chopped parts do not contain the delimiters (they are omitted totally)
  • Spaces, numbers and symbols are treated like normal characters.
  • Several delimiters can be used at a time. Use the | character to separate them.
  • The chopped parts are numbered from left, as $1, $2, $3, etc.
The same parts can be referred from the end as $-1, $-2, $-3, etc.
  • If the delimiter occurs at the very beginning of the name, the resultant $1 contains nothing (because there is nothing on the left side of the delimiter).
Positions

Chops the name at the indicated position (the count begins with 1).

  • If you enter position n, ReNamer will chop the n-th character and all characters beyond that in a separate piece.
  • Spaces, numbers and symbols are treated like normal characters.
  • No part of the original name is omitted during chopping.
  • You can enter multiple positions. Separate them with the | character.
  • The chopped parts are numbered from left, as $1, $2, $3, etc.
The same parts can be referred from the end as $-1, $-2, $-3, etc.
Right-to-left

If selected, the numbering starts from right.

  • The characters of the original names are counted from right (the count begins with 1)
  • The chopped parts will also be numbered from right ($1, $2, etc.)
PlusButton.png Adds a | character between two delimiter entries, and separates them.
(You can directly type the | character instead of clicking on this button.).
New pattern

How to compose the new name from the parts created from the original name (see above).

  • You can add meta tags and literal text wherever you want.
  • $0 refers to the whole original name. This allows you to quickly compose a new name by inserting a string at the beginning and/or end.
ReNamer Insert Meta Tag Button.png Click the button to see a list of meta-tags. Select any meta tag to insert it in the new name template.

This rule can be used in a many ways. Only a few examples are given below.

For simplicity's sake, we have split the uses in two parts:

  1. Basic uses (typical needs of beginners)
  2. Advanced uses (for the power users)

Task: Switch the words, and remove the comma between them.

From: To:
King, Stephen Stephen King
Cook, Robin Robin Cook
Pride and Prejudice, The The Pride and Prejudice

Settings:

Delimiter: ", " (without the quotes)

New Order: $2 $1

Example 2

Task: Move a word to a new position.

From: To:
Words sample 1234 07-07-07 1234 Words sample 07-07-07

Settings:

Delimiter: " " (only a space, without the quotes)

New Order: $3 $1 $2 $4

Example 3

Task: Get rid of the numbers, hyphen and space at the beginning.

From: To:
01 - Afilename.zip Afilename.zip
002 - Bfilename.zip Bfilename.zip
0003 - Cfilename.zip Cfilename.zip

Settings:

Delimiter: "- " (without the quotes)

New Order: $2

Remarks:

  1. Note that the delimiter contains a space. If only a hyphen is used as delimiter, then a space would be left out in the beginning of the name, which you would have to trim separately.
  2. The Delete rule also would work (in right-to-left mode). But the Rearrange rule also allows you to add any string to the truncated names.

Example 4

Task: Move the first part to the end.

From: To:
TEST.aaa.bbb.100.ext aaa.bbb.100.TEST.ext

Setting:

Delimiter: "." (without the quotes)

New Order: $2.$3.$4.$1

Example 5

Task: Move the artist's name from end to the beginning, and change the name format.

From: To:
Ring ring_ABBA.mp3 ABBA - Ring Ring.mp3
Material girl_Madonna.mp3 Madonna - Material girl mp3

Settings:

Delimiter: "_" (without the quotes)

New Order: $2 - $1

Example 6

Task: Move the numbers to the beginning.

From: To:
DSC_0001-1.jpg 1-DSC_0001.jpg
DSC_0001-2.jpg 2-DSC_0001.jpg
DSC_0001-10.jpg 10-DSC_0001.jpg

Settings:

Delimiter: "-" (without the quotes)

New Order: $2-$1

Example 7

Task: Insert "sent_" before the last 3 digits.

From: To:
family_001.jpg family_sent_001.jpg
work_023.jpg work_sent_023.jpg
friend_098.jpg friend_sent_098.jpg

Settings:

Delimiter: "_" (without the quotes)

New Order: $1_sent_$2

Remarks:

The Insert rule also would work (in right-to-left mode). But the Rearrange rule also allows you to add any string to the names.

Example 8

Task: Remove the name of the artist (delete text until hyphen).

From: To:
Sting - All This Time.mp3 All This Time.mp3

Settings:

Delimiter: "- " (without the quotes)

New Order: $2

Remarks:

  1. Note the space after the hyphen. If we use just a "-" as delimiter, the second token would be left with a space in front, which we will have to trim separately.
  2. Even the Delete rule would have worked (in right-to-left mode). But the Rearrange rule also allows you to add any string to the new name.

Example 9

Task: Remove the track numbers (and any separator symbol after that) from the beginning of the filenames:

From: To:
08. Madonna - Like A Prayer.wma Madonna - Like A Prayer.wma
08.-Madonna - Like A Prayer.wma
08 Madonna - Like A Prayer.wma

Settings:

Delimiter: "Madonna" (without the quotes)

New Order: Madonna$2

Remarks:

We chose the string "Madonna" as delimiter because it does not occur anywhere else in the names. The unwanted characters on the left are assigned to token $1, which we will not omit in the new name. However, there is an undesired side-effect: ReNamer removes "Madonna" string from the token $2 because it is the delimiter. Therefore, we have to manually add that missing string "Madonna" to $2, to restore the names.

Example 10

Task: Move the number to front, and remove the square brackets.

From: To:
Name XXX [0001].jpg 0001 - Name XXX.jpg

Settings:

Delimiter: "[|]" (without the quotes)

New Order: $2 - $1

Remarks:

  1. The | character is used to separate the two delimiters.
  2. The second delimiter "|" will not produce a token. It is included only to remove it from the new name.

Example 11

Task: Add composer name and duration to an mp3 file, as prefix and suffix, respectively.

From: To:
Eine kleine Nachtmusik.mp3 Mozart - Eine kleine Nachtmusik (6.37).mp3
Don Giovanni.mp3 Mozart - Don Giovanni (4.5).mp3

Settings:

Positions: 1

New Order: Mozart - $2 (:AudioDuration:)

Remarks:

  1. This can also be done by using the Insert rule. However, you have to use that rule twice (once for prefix and the second time for the suffix). On the other hand, the Rearrange rule allows you to add both in a single stroke. Besides, you can see the structure of the new name.
  2. When the original name is sliced at position 1, there is no characters on the left side; so the $1 token is a blank. The entire name is copied into the $2 token. This is a great trick to compose new name using the whole original name.

Advanced uses

Example 1

Task: Remove the string from the file name.

From: To:
Artist - Title [Time 4 02 Cold] [2004].mpg Artist - Title [2004].mpg

Settings:

Delimiter: " [T|d] " (without the quotes)

New Order: $1 $3

Remarks:

  1. The | character separates the two delimiters.
  2. Notice that we have included spaces in the delimiters, so that they do not end up as part of the tokens.
  3. We have selected two different delimiters to represent the beginning and the end of the string we want to remove. Thus whatever lies between the two delimiters is converted into a token. This token is then omitted in the new name. This works just like using wildcards for the string (or a RegEx pattern).

Example 2

Task: The file names contain artist name, album name and track name. Sort them into separate folders as follows:

  1. Create a separate folder for each artist.
  2. For each artist, create a subfolder for each album.
  3. Move each file in the corresponding folder.
From: To:
Title - Artist (Album).mp3 D:\Artist\Album\Title.mp3

Settings:

Delimiter: " - | (|)" (without the quotes)

New pattern: D:\$2\$3\$1

Remarks:

  1. Note that the delimiters contain spaces and symbols, so that only text remains in the tokens.
  2. The last delimiter ) does not produce a token. It is added just to strip the closing bracket from the last token.
  3. Instead of D: a relative path (such as ..\..\) can be added to the front.

Example 3

Task: Sort digital photos in different folders based on the Date taken for each photo.

From: To:
DSC_0001.jpg D:\photos\trip\2009_10_21\DSC_0001.jpg
DSC_0002.jpg D:\photos\trip\2009_10_21\DSC_0002.jpg
DSC_0125.jpg D:\photos\trip\2009_10_25\DSC_0125.jpg

Settings:

Delimiter: "D" (without the quotes)

New pattern: D:\photos\trip\:EXIF_Date:\D$2

Remarks:

  1. Note that this EXIF data is contained in the meta tag of each photo, not in the file name.
  2. The meta tag :EXIF_Date: is replaced by the actual date taken for each photo. Thus all photos taken on the same date will be moved to the same folder.
  3. The actual name of the folder would depend on the Date and Time format settings.

Example 4

Task: Delete the last part of the base name (but the extension should remain). Note that the file names have different lengths, so you cannot slice the name at a particular position. The names have a different depths also (number of segments separated by dots).

From: To:
title.text1.text2.extension title.text1.extension
title.text1.text2.text3.extension title.text1.text2.extension

Setting: The solution requires a stack of two different rules, as shown below:

1. Replace Rule

Find: "." (without the quotes)

Replace: "#" (without the quotes)

(this is a temporary change; which will be eliminated in the second step)

2. Rearrange rule

Delimiter: "#" (without the quotes)

New Order: $1

Remarks:

We had to do this indirectly because the Rearrange rule cannot pick only the last dot as delimiter; and ignore the other dots. So we used a trick: we first changed the last dot into another character (using the Replace rule), and then use that new character as delimiter in the Rearrange rule.