ReNamer:Rules:Rearrange: Difference between revisions

From den4b Wiki
Jump to navigation Jump to search
No edit summary
Line 13: Line 13:


== Basic uses ==
== Basic uses ==
=== Example 1 ===
=== Example 1 ===


{| align="center" class="prettytable"
'''Task:''' Switch the name and surname''', '''and remove comma.
{| class="prettytable"
|-
|-
| <center>'''Change from-'''</center>  
| <center>'''Change from-'''</center>  
Line 31: Line 32:


|}
|}
'''Task:''' Switch the name and surname''', '''and remove comma.


<br> '''Setting:'''  
<br> '''Setting:'''  

Revision as of 14:15, 16 August 2009


This rule allows you to cut the exiting file name anyway you like and reuse the parts to compose a new name.

You can also add your own text, or use any meta tags to compose the new name.

There are a huge number of possible uses. Only a few examples are given here.

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

  1. Basic uses (typical needs of beginners would be met with these examples)
  2. Advanced uses (for the power users)

Basic uses

Example 1

Task: Switch the name and surname, and remove comma.

Change from-
To-
King, Stephen

Cook, Robin

Pride and Prejudice, The

Stephen King

Robin Cook

The Pride and Prejudice


Setting:

Delimiter: ", " (without the quotes)

New Order: $2 $1

Example

Change from-
To-
Words sample 1234 07-07-07 1234 Words sample 07-07-07

Task: Move a word to a new position.


Setting:

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

New Order: $3 $1 $2 $4

Example

Change from-
To-
01 - Afilename.zip

002 - Bfilename.zip

0003 - Cfilename.zip

Afilename.zip

Bfilename.zip

Cfilename.zip

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


Setting:

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

Change from-
To-
TEST.aaa.bbb.100.ext aaa.bbb.100.TEST.ext

Task: Move the first part to the end.


Setting:

Delimiter: "." (without the quotes)

Skip Extension [X]

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


Example

Change from-
To-
Ring ring_ABBA.mp3

Material girl_Madonna.mp3

ABBA - Ring Ring.mp3

Madonna - Material girl mp3

Task: Move the artists’ name from end to the beginning, and change the name format.


Setting:

Delimiter: "_" (without the quotes)

Skip Extension [ ]

New Order: $2 - $1

Example

Change from-
To-
DSC_0001-1.jpg

DSC_0001-10.jpg

DSC_0001-2.jpg

1-DSC_0001.jpg

10-DSC_0001.jpg

2-DSC_0001.jpg

Task: Move the numbers to the beginning.


Setting:

Delimiter: "-" (without the quotes)

New Order: $2-$1


Example

Change from-
To-
family_001.jpg

work_023.jpg

friend_098.jpg

family_sent_001.jpg

work_sent_023.jpg

friend_sent_098.jpg

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

Setting:

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

Change from-
To-
Sting - All This Time.mp3 All This Time.mp3

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


Setting:

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

Change from-
To-
08. Madonna - Like A Prayer.wma

08.-Madonna - Like A Prayer.wma

08 Madonna – Like A Prayer.wma

Madonna – Like A Prayer.wma

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


Setting:

Delimiter: "Mad" (without the quotes)

New Order: Mad$2


Remarks:

We chose the string “Mad” 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 “Mad” string from the token $2 because it is the delimiter. Therefore, we have to manually add that missing string “Mad” to $2, to restore the names.

Example

Change from-
To-
Name XXX [0001].jpg 0001 - Name XXX.jpg

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


Setting:

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

Change from-
To-
Eine kleine Nachtmusik.mp3

Don Giovanni.mp3

Mozart - Eine kleine Nachtmusik (6.37).mp3

Mozart - Don Giovanni (4.5).mp3

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


Setting:

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

Change from-
To-
Artist - Title [Time 4 02 Cold] [2004].mpg Artist - Title [2004].mpg

Task: Remove the string [Time ???? Cold] from the file name.


Setting:

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

Change from-
To-
Song title1 – Artist1 (Album1).mp3

Song title2 – Artist1 (Album1).mp3

Song title1 – Artist1 (Album2).mp3

Song title2 – Artist1 (Album2).mp3

Song title1 – Artist2 (Album1).mp3

Song title1 – Artist2 (Album1).mp3

D:\Artist1\Album1\Song title1.mp3

D:\Artist1\Album1\Song title2.mp3

D:\Artist1\Album2\Song title1.mp3

D:\Artist1\Album2\Song title2.mp3

D:\Artist2\Album1\Song title1.mp3

D:\Artist2\Album1\Song title2.mp3

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.

Setting:

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

Skip Extension [x]

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

Change from-
To-
DSC_0001.jpg

DSC_0002.jpg

DSC_0003.jpg

DSC_0004.jpg

…..

DSC_0125.jpg

D:\photos\trip\2009_10_21\DSC_0001.jpg

D:\photos\trip\2009_10_21\DSC_0002.jpg

D:\photos\trip\2009_10_21\DSC_0003.jpg

D:\photos\trip\2009_10_22\DSC_0004.jpg

………

D:\photos\trip\2009_10_25\DSC_0125.jpg



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


Setting:

Delimiter: "D" (without the quotes)

Skip Extension [x]

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 (which is named after that date).
  3. The actual name of the folder would depend upon the current settings for the system date format. (If you want the folders to be named after a different date format, first change the system date format, using the Regional and Language Options option in the Control Panel.)

Example

Change from-
To-
title.text1.text2.extension

title.text1.text2.text3.extension

title.text1.extension

title.text1.text2.extension

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).


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

1. Replace Rule

Find: "." (without the quotes)

Replace: “# “(without the quotes)

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


2. Rearrange rule

Delimiter: "#" (without the quotes)

Skip Extension [X]

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.