How to create naming script for year, month and day?

Tags: #<Tag:0x00007fea3acfc570>

Currently my file naming script is the following:
$if(%_subfolder%,%_subfolder%)/
$if2(%albumartist%,%artist%)/
[$if2(%originaldate%,%date%)] %album% $if(%catalognumber%,{%catalognumber%})/
$if(%discnumber%,%discnumber%,1).$num(%tracknumber%,2). %title%

The output (of the folder) will be: [1977-06-03] Exodus {1734079}
What I want is: [1977.06.03] Exodus {1734079}

I’ve tried adding: $if(%Y%.,%M.%D%), $if(%year%.,%month.%day%), and a few more less obvious ones. None of them worked.
I tried to understand their documentations but it didn’t make sense to me (I don’t know anything about scripting), I followed this link “$datetime — MusicBrainz Picard v2.6.3 documentation” and added “$datetime(%Y-%m-%d)” to my script which gave me an “unknown function ‘datetime’” error.

Thanks in advance! I’m also curious of the name preferences people here have.

There is no function yet to format date. $datetime returns the current date and time only.

In the meantime you could use e.g. $replace:
[$replace($if2(%originaldate%,%date%),-,.)]

2 Likes

Sorry - but %M%, %Y% etc. do not exist as standard. Only the variables defined in the documentation site you referenced exist as standard, and all the other possible variable names (like %M% or %herkjrhk%) don’t I’m afraid.

Sorry to troll a bit but what is the need between “-” and “.” ?
See ISO 8601 - Wikipedia at Calendar Dates
Sometimes standards are needed

This is for file naming and @luutoo can use any format he/she wants.

Of course, if it was structured data i.e. a specific date/time tag, then having it formatted in the standard way as @ulugabi suggests would be essential for e.g. a music player to parse it correctly.

2 Likes