Siren FAQ & More Examples

[Table of Contents & Credits--start]
Note: This section and any headers enclosed in square brackets are not part of the original files.

"Siren is a file renaming program" that can be found at http://scarabee-software.net/en/siren.html.

All the following content credit goes to Siren's author. Main help at https://rentry.co/siren_help.
[Table of Contents & Credits--end]


[FAQ]

Q01: PNG, TIFF or PCX images can't be viewed, is it normal?
A: For now, only JPG, BMP, GIF, ICO and CUR images can be viewed.

Q02: Some images are not displayed despite other programs doing it without problems. Why?
A: The display function used is sensitive to invalid images. Controls have been added and such images may not pass them.

Q03: In the list, I see information I would like to use in the renaming expression but I don't know the associated variable. What can I do?
A: Right-clicking on such information allows for insertion of its value or associated variable in the expression. New names preview of selected files are immediately recomputed.

Q04: What is "Exif information"?
A: Exif ("Exchangeable Image File Format") is a standard for storing information in image files. Most recent digital cameras use it to store data related the photo: Date, focal length, shutter speed, etc.

Q05: How to quick access the variable list available for composing renaming expressions?
A: A system of auto-completion has been implemented. By right-clicking, pressing 'Ctrl+space' or 'F1' in the expression combo, a window will appear. All available variables are listed. And by double-clicking on a list item, its code will be automatically inserted.

Q06: How to use special characters like normal ones?
(How to rename a file "Image.jpg" to "Image[2].jpg" with the expression %b[2].%e, for example?)
A: To escape the special status of a character, place a "\" (backslash) before it. (So the expression would be %b\[2].%e).

Q07: What is the difference between "Track" and "Track Number"?
A: Notice "Track" is only present in the "Audio" tags. Unlike its equivalent in the id3v1 tag, it's a free-form string. "track number/_number of tracks_" is one of the standard expressions: . Siren will automatically parse it and initialize "Track Number" and "Number of Tracks".

Q08: While dropping a directory, only the parent directory is loaded. How to directly load the one dropped?
A: Drop it onto the "directory" field.

Q09: How to activate the shell context menu for the current directory?
A: Right-click on the "directory" field or highlight (turn blue) the ".." in the file list and right click to get the default shell context menu.

Q10: A error occurs when using the "Send To" shortcut.
A: The two main causes for this are: Either the Siren executable changed place (force an "Update" of the shortcut through the "File" menu) or too many files have been selected before the call (and the system limits have been exceeded).

Q11: If ".." is highlighted in the file list, "Explore" or "Shell Context Menu" are executed on the current directory.
A: This is normal. It's a shortcut to access the current directory.

Q12: How to have access to Siren's command line syntax?
A: Like with standard commands, call Siren with "/?" or "/help" parameters. [See "CLI Parameters" below.]

Q13: How to use two different Siren configurations? (One on MP3 files and another on other files, for example...)
A: All of Siren's configuration information are saved in an INI file. By default the name of this file is "Siren.ini" and is contained in the same directory as the program. The command line parameter "/p" allows choosing the filename of the configuration file to be used. If two shortcuts to "Siren.exe" are created, one specifying "/p mp3.ini" as command line parameter, this will permit different configurations. When a specific file is in use, its name will appear on the title bar. [Please check "CLI Parameters" below]

Q14: Can keyboard shortcuts be used in the "Favorites" menu?
A: Yes, by placing a "&" before the chosen character included in the favorite's name.


[More Examples]

Here are some detailed examples that will, I hope, help you to write rename expressions.


[Ex01]

  • Rename an image with its original date and time

From:
"IMG_3975.JPG" taken the 09/09/2003 at 21h47m58s
"IMG_3981.JPG" taken the 09/09/2003 at 21h49m35s

To:
"Planet_Mars_20030909_214758.jpg"
"Planet_Mars_20030909_214935.jpg"

Use the expression:
Planet_Mars_%Xdo.jpg

  • How does it work?

Most digital cameras add meta-data to their images. Among it is the date the image was taken [according to the camera internal clock].

Siren extracts that information and makes it usable in an expression through the variable: %Xdo (eXif DatetimeOriginal).

Like all other dates, it follows the YYYYMMDD_HHMMSS format.

Thus, following for "IMG_3975.JPG" the expression results in:
Planet_Mars_ will give "Planet_Mars_"
Planet_Mars_%Xdo will give "Planet_Mars_20030909_214758"
Planet_Mars_%Xdo.jpg will give "Planet_Mars_20030909_214758.jpg"


[Ex02]

  • Names with numbers of different sizes

From:
"Img1.jpg"
"Img2.jpg"
"_Img10.jpg`

To:
"Img_001.jpg"
"Img_002.jpg"
"Img_010.jpg"

Use the expression:
Img_%N.%e

  • How does it work?

An annoying situation, because alphabetically "Img2.jpg" comes after "Img10.jpg".

%N is a variable that will hold the first number from the base filename. For "Img2.jpg", %N will contain "2" -- well, in fact, it will contain "002" or "02", depending on the size defined in "Options/_Numbers_".

%e, the file extension is "jpg"

So, following the expression for "Img2.jpg":
Img_ will give "Img_"
Img_%N will give "Img_002"
Img_%N. will give "Img_002."
Img_%N.%e will give "Img_002.jpg"


[Ex03]

  • Change filename case (uppercase/lowercase)

From:
"_SONG TITLE.MP3"

To:
"Song title.mp3"

Use the expression:
%Lf

  • How does it work?

It's possible to add a case modifier (upper/lower) between the character "%" and the name of the variable.

It only modifies the string it is associated to. Four or them exist: L sets only the first character uppercase and the rest lowercase [setence case].

%f represents the full name of the file.

So, following the expression:
%f will give "SONG TITLE.MP3"
%Lf will give "Song title.mp3"


[Ex04]

  • Replace dots with spaces

From:
"My.preferred.movie.avi"

To:
"My preferred movie.avi"

Use the expression:
%b("."," ").%e

  • How does it work?

Here, the replacement modifier is used with two parameters: the string to be replaced, and the replacement string.

To substitute all the "." with " ", so the first will be "." and the second " ".

We apply this modifier on %b, which is the base filename (filename minus the extension).

If applying it on %f (full name), it would also replace the "." that separates the extension.

%e, the file extension is "avi"

So, following the expression:
%b will give "My.preferred.movie"
%b("."," ") will give "My preferred movie"
%b("."," "). will give "My preferred movie."
%b("."," ").%e will give "My preferred movie.avi"


[Ex05]

  • Change date formats

Let's change the file "Note.txt" modified the 01/02/2003.

From:
"Note.txt"

To:
"Note-01-02-03.txt"

Use the expression:
%b-%dmd(5,2)-%dmd(7,2)-%dmd(3,2).%e

  • How does it work?

%b corresponds to the file base name, in this case "Note".

%dmd corresponds to the last modification date following the format YYYYMMDD, so here it would be "20030102"

Of interest in this variable are only some parts of it, which are separated by "-".

It's possible extract them by using the extract by string position modifier.

The format shows that:
the month corresponds to 2 characters, starting at the 5th position
the day corresponds to 2 characters, starting at the 7th position
the year corresponds to 2 characters, starting at the 3rd position

so the modifier "()" does this easily.

%dmd(7,2) extracts 2 characters at the 7th position: "02", i.e., the day numbers

%e is the file extension, "txt" in this case.

So, following the expression:
%b will give "Note"
%b- will give "Note-"
%b-%dmd(5,2) will give "Note-01"
%b-%dmd(5,2)- will give "Note-01-"
%b-%dmd(5,2)-%dmd(7,2) will give "Note-01-02"
%b-%dmd(5,2)-%dmd(7,2)- will give "Note-01-02-"
%b-%dmd(5,2)-%dmd(7,2)-%dmd(3,2) will give "Note-01-02-03"
%b-%dmd(5,2)-%dmd(7,2)-%dmd(3,2). will give "Note-01-02-03."
%b-%dmd(5,2)-%dmd(7,2)-%dmd(3,2).%e will give "Note-01-02-03.txt"


[Ex06]

  • Extract the end of a filename string

From:
"A0B1C2DE_0201.jpg"
"A1B#0302.gif"

To:
"0201.jpg"
"0302.gif"

Use the expression:
%f(-8)

  • How does it work?

The "()" modifier allows the extraction of part of the string it is associated with.

It's first parameter is the starting position of this extraction, an optional second parameter specifies the number of characters to extract.

If the second value is not given, extraction is done until the end.

Which value to choose as starting position?

It depends on the filenames present, so they must we examined. In this case, it's 10 for first and 5 for the second...

In fact, we only need the last 8 characters so it would be best to specify the position of the first character to extract relative to the end of the string and not its begining.

Siren can do this using negative numbers.

With "ABCDEF", for example:
%b(2,1) will give "B": positive start, relative to beginning of string
%b(-2,1) will give "E": negative start, so relative to its end

More straightforward, "-8" will specify the 8 last characters.

%f is the full file name.

So, following the expression for"A1B#0302.gif":
%f will give "A1B#0302.gif"
%f(-8) will give "0302.gif"


[Ex07]

  • **Extract the beginning of a filename string

From:
"A0B1C2DE_0201.jpg"
"A1B#0302.gif"

To:
"A0B1C2DE.jpg"
"A1B.gif"

Use the expression:
%b(1,-5).%e

  • How does it work?

In the previous example, the "()" modifier allows defining an extraction count relative to the end of a string.

Here the problem is slightly different; this time it's the character count that must be relative to the length of the string.

Giving a negative value to the character count (i.e., the 2nd parameter) the position of the last extracted character from the string will be computed this way: length of the string minus the absolute value of the parameter.

In our case, %b as applied to:
"A0B1C2DE_0201", equals 13 characters
"A1B#0302", equals 8 characters

%b(1,-5) will be equivalent on "A0B1C2DE_0201" to:
13 - 5, so 8 characters starting at position 1 give "A0B1C2DE"

And on "A1B#0302" to:
8 - 5, so 3 characters starting at position 1 give "A1B"

%e, the file extension is "gif".

Following the expression on "A1B#0302.gif":
%b will give "A1B#0302"
%b(1,-5) will give "A1B"
%b(1,-5). will give "A1B."
%b(1,-5).%e will give "A1B.gif"


[Ex08]

  • Invert elements, deleting some

From:
"Song Title 1 - Singer - Site.mp3"
"Title 2 - Singer.mp3"

To:
"Singer - Song Title 1.mp3"
"Singer - Title 2.mp3"

Use the expression:
%b[2] - %b[1].%e

  • How does it work?

The "[]" modifier carries very powerful functionality.

Siren splits the associated string in array elements following the characters specified in "Options/_Modifications_" (or provided as second parameter to "[]").

Each substring is accessible through its index.

In this case, if "-" is one of the separators:
%b will give "Song Title 1 - Singer - Site"
%b[1] will give "Song Title 1"
%b[2] will give "Singer"
%b[3] will give "Site"
If the index is negative, the count start from the end:
%b[-1] will give "Site"
%b[-2] will give "Singer"
%b[-3] will give "Song Title 1"

%e, the file extension is "mp3".

So, following the expression:
%b[2] will give "Singer"
%b[2] - will give "Singer - "
%b[2] - %b[1] will give "Singer - Song Title 1"
%b[2] - %b[1]. will give "Singer - Song Title 1."
%b[2] - %b[1].%e will give "Singer - Song Title 1.mp3"


[Ex09]

  • Use the array string extraction despite elements being separated with strings

From:
"Artist =##= Album =##= Song.mp3"

To:
"Song.mp3"

Use the expression:
%b("=##=","-")[3].mp3

  • How does it work?

It's clear that the array extraction must be used (especially if there are many files to rename).

But different elements are separated with strings and not single characters -- that would be possible to add to "Options/_Modifications_" or pass as second parameter to "[]".

The idea here is to concatenate the modifiers and is apply modifications to the preceding result.

By replacing "=##=" with a "-" permits use of the simpler "[]" modifier without problems.

In previous examples, such replacements have already been made.

%e, the file extension is "mp3".

So, following the expression:
%b will give "Artist =##= Album =##= Song"
%b("=##=","-") will give "Artist - Album - Song"
%b("=##=","-")[3] will give "Song"
%b("=##=","-")[3]. will give "Song."
%b("=##=","-")[3].%e will give "Song.mp3"


[Ex10]

  • The "The" problem

Suppose there are many MP3 files whose filenames are formatted in this way:

"Artist - Song.mp3"

To be correctly named, Beatles filenames will start with "The Beatles".

That naming raises the problem that such files should be listed in the "B" sequence rather the "T".

From:
"The Beatles - Eleanor Rigby.mp3"
"The Name of the group - Song title - Album.mp3"

To:
"Beatles, The - Eleanor Rigby.mp3"
"Name of the group, The - Song title.mp3"

Use the expression:
%b[1](5), The - %b[2].%e

  • How does it work?

This applies a combination of extraction by array and by position.

On the file:

"The Beatles - Eleanor Rigby.mp3"

%b[1] will give "The Beatles" and %b[2] will give "Eleanor Rigby".

The next modifier (5) performs extraction on the string it is associated to; in this case: %b[1] so "The Beatles".

The number "5" points the starting position and the absence of a second parameter means the extraction is to go to the end of the string.

So %b[1](5) (from 5th character of "The Beatles") will give "Beatles".
%b[2] will give "Eleanor Rigby".
%e, the file extension is "mp3".

So, applying the expression to "The Beatles - Eleanor Rigby.mp3":
%b[1] will give "The Beatles"
%b[1](5) will give "Beatles"
%b[1](5), The - will give "Beatles, The - "
%b[1](5), The - %b[2] will give "Beatles, The - Eleanor Rigby"
%b[1](5), The - %b[2]. will give "Beatles, The - Eleanor Rigby."
%b[1](5), The - %b[2].%e will give "Beatles, The - Eleanor Rigby.mp3"


[Ex11]

  • All for one!

From:
"SONG.TITLE =##= THE SINGER - SITE.MP3"
"ANOTHER.SONG.TITLE =##= THE NAME OF THE GROUP - SITE 2.MP3"

To:
"Singer, The - Song title.mp3"
"Name Of The Group, The - Another song title.mp3"

Use the expression:
%Ub("=##=","-")[2](5), The - %Lb("=##=","-")[1]("."," ").%le

  • How does it work?

The main point of the present example is to understand the sequence of different operations.

Expressions are evaluated left to right.

Each modifier takes on input from the text coming out the variable or from the preceding modifier.

After doing its task, it gives the result to the next one. This will happen until the end of the series.

There's only one exception to this rule: character modifiers are the last to be applied.

Let's examine this step by step on:

"SONG.TITLE =##= THE SINGER - WEB SITE.MP3"

%b will give "SONG.TITLE =##= THE SINGER - SITE.MP3"
%b("=##=","-") will give "SONG.TITLE - THE SINGER - SITE.MP3"
%b("=##=","-")[2] will give "THE SINGER"
%b("=##=","-")[2](5) will give "SINGER"
%Ub("=##=","-")[2](5) will give "Singer"

The string "Singer" is then put on the future name holder.

Next, there is some literal text: ", The - ", which gets added, too.

Now, the future name holder contains: "Singer, The - "

Then:
%b will give "SONG.TITLE =##= THE SINGER - SITE.MP3"
%b("=##=","-") will give "SONG.TITLE - THE SINGER - SITE.MP3"
%b("=##=","-")[1] will give "SONG.TITLE"
%b("=##=","-")[1]("."," ") will give "SONG TITLE"
%Lb("=##=","-")[1]("."," ") will give "Song title"

This too, get's added to the future name holder, which now contains: "Singer, The - Song title"

The literal text "." is then added, so now we've got: "Singer, The - Song title."

Then:
%e will give "MP3"
%le will give "mp3"
(the case modifier "l" sets the string to lowercase)

So, in the end the new filename built is:
"Singer, The - Song title.mp3"


[Ex12]

  • Delete part of a string, from beginning until a given character

From:
"Good - Singer - Title 1.mp3"
"Excelent - Singer - Title 2 - Site.mp3"

To:
"Singer - Title 1.mp3"
"Singer - Title 2 - Site.mp3"

Use the expression:
%b("-","*",1,1)[2,"*"].%e

  • How does it work?

The idea here is to replace a chosen character with another and use this last one as an array element separator.

The modifier ("-","*",1,1) will replace the first "-" with "*".

The following modifier [2,"*"] will extract the second element of the string using "*" as separator and not one of those defined in "Options/_Modifications_" so that the first part will just be deleted.

Why use the character "*" as separator?

Because it can never be a part of a filename (it's forbidden in all systems), ensuring that it will only be found during string manipulation.

%e, the file extension is "mp3".

So, following the expression:
%b will give "Good - Singer - Title 1"
%b("-","*",1,1) will give "Good * Singer - Title 1"
%b("-","*",1,1)[2,"*"] will give "Singer - Title 1"
%b("-","*",1,1)[2,"*"]. will give "Singer - Title 1."
%b("-","*",1,1)[2,"*"].%e will give "Singer - Title 1.mp3"


[Ex13]

  • Delete a delimited substring

From:
"Title 1 (www.site.net) Singer 1.mp3"
"Title 2(192 (44100) 3m30s)Singer 2.mp3"

To:
"Title 1 - Singer 1.mp3"
"Title 2 - Singer 2.mp3"

Use the expression:
%f[1,"("] - %f[-1,")"]

  • How does it work?

The idea here is to treat "(" and ")" as array element separators.

Extraction modifier "[]" will admit a second parameter providing a list of separator characters (and replacing the default one defined in "Options/_Modifications_").

Why use "-1" as index for the second extraction?

The number of ")" present in the original filename string may not be known.

"-1" will return the first element found starting from the end of the string; i.e., the string after the last ")".

Thus, following the expression:
%f will give "Title 1 (www.site.net) Singer 1.mp3"
%f[1,"("] will give "Title 1"
%f[1,"("] - will give "Title 1 - "
%f[1,"("] - %f[-1,")"] will give "Title 1 - Singer 1.mp3"


[CLI Parameters]

Here's the output of > siren /h command. (> siren /? also works, but it complains of unrecognized parameter.)

Siren 3.12
Copyright (C) 2002-2013 Remi PASCAL (scarabee-software.net)
Siren is a file renamer
Siren is free of charge and distributed under the GPLv3 license

Usage:

> siren [/d <str>] [/f <str>] [/s <str>] [/x[-]] [/t] [/e <str>] [/F <str>] [/r] [/c] [/q] [/l <str>] [/p <str>] [/P] [file/dir]

  /v, --version                 print version information
  /h, --help                    show this help message
  /d, --dir=<str>               directory to load
  /f, --filter=<str>            loading filter
  /s, --select=<str>            selection filter
  /x, --listhidden              list hidden directories and files
  /t, --subdir                  force the loading of sub directories
  /e, --expression=<str>        renaming expression
  /F, --favname=<str>           name of a favourite expression
  /r, --rename                  execute a rename operation
  /c, --copy                    execute a copy operation
  /q, --quit                    quit after rename/copy execution
  /l, --language=<str>          language (en, en_US, fr_FR ...)
  /p, --paramfile=<str>         configuration file
  /P, --nosaveparam             don't save configuration parameters
Edit
Pub: 02 May 2020 20:27 UTC
Edit: 06 May 2020 09:12 UTC
Views: 1146