Renaming help - adding ( and ) to disc # and adding leading 0 to %tracknumber%

filenaming
Tags: #<Tag:0x00007f23c1991920>

#1

Hi there,

I’m trying to rename & move files as:
Artist - Year - Album (Disc 2+)
Track # - Title

Current code is:
$if($eq([non-album tracks],%album%),%artist%/%tracknumber%,%artist% - $if(%date%,$left(%date%,4)) - %album% $if($gt(%totaldiscs%,1),Disc $num(%discnumber%,1))/%tracknumber% - )%title%

I have 2 items I couldn’t accomplish

  • Adding opening and closing parenthesis ( & ) to disc - i tried adding ‘(’ and ‘)’ but I get an unexpected character error.
  • Making track number with a leading 0. According to the foobar naming standards %tracknumber% should have the leading 0 and %track number% shouldn’t - but on MusicBrainz Picard I don’t get leading 0.

Any ideas? Thanks!


#2

To add parentheses, you have to prefix them with a backslash: \( \)

For leading zeroes you can use $num to format numbers with a certain number of digits, shorter numbers will be filled with leading zeroes. $num(%tracknumber%,2) will format the track number as 01, 02, 03, etc. and $num(%tracknumber%,3) will give you 001, 002, 003.