Conditional Naming Help

Hi guys,

I am not a programmer, trying my best here follow some tutorials and figure this out… I am almost there.
I like to name my files with (Studio - … (Live - … (Compilation -… In the end I get results like, supose Anthrax albums:

(Compilation - 2004) The Greater of Two Evils
(Live - 1994) The Island Years
(Studio - 1987) Fistul of Metal

My full naming script is:

$if($in(%releasetype%,album), $set(_isAlbum,1) )
$if($in(%releasetype%,album/live), $set(_isLive,1) )
$if($in(%releasetype%,single), $set(_isSingle,1) )
$if($in(%releasetype%,ep), $set(_isEP,1) )
$if($in(%releasetype%,album/compilation), $set(_isArtistCompil,1) )

$if($is_complete(),Complete Albums,Missing Tracks)/







- $year(%date%,4)) %album%/

(%album% - $year(%date%,4)) $num(%tracknumber%,2) - %title%

Seems bit messy pasting, here a SShot:

Ok, I keep getting on (Studio - …


First off, I’m assuming that you’re doing the renaming based on the metadata from MusicBrainz (in other words after matching your files to tracks in the right-hand pane) rather than metadata existing in the files. That said, try the following:


$if($is_complete(),Complete Albums,Missing Tracks)/
%albumartist%/\(%_type% - %_year%\) %album%/
\(%album% - %_year%\) $num(%tracknumber%,2) - %title%

Note that I’ve used the %_primaryreleasetype% and %_secondaryreleasetype% variables for more specific checking, and escaped the opening and closing brackets that you want to appear in the output. I’ve also included a default type of Unknown in case there were no matches and a default year of 0000 if the %date% tag is empty. Finally, I’ve taken the liberty of refactoring a little to reduce the number of interim variables.

Part of the problem with your existing code was that “album/live” and “album/compilation” are not valid entries in the `%releasetype% variable and would therefore always fail the checks. The reason that the date portion was missing is because the enclosing brackets were not escaped, thus Picard tried to interpret the content between the brackets as code.

Please let us know if this does what you are looking for.


As a tip, you can put the Picard script in a code block and the forum here will show it with syntax highlighting. See the description at

I took the freedom to edit your post to use this instead of the quote.