Help with file renaming script

Hi everyone. Yesterday I made some posts on Reddit asking for help to tidy up and organize my entire flac music library (2 tb).

Several people recommended Picard to me and here I am trying to learn how to use it. I want to ask you about creating a script to rename my files.

I would like it to start with the artist’s name (Tool), inside the folder with the artist’s name there should be the folders with the albums with their year before the name, with a dash and a space (1992 - Opiate EP) and inside each folder of each album there should be the track number, space dash space and the name of the track (01 - Sweat). Could you help me create that script so I can see what it looks like and learn to create my own please?

The script that is closest to what I want is this one up to here:

%albumartist%/%date% - %album%/%tracknumber% - %title%

But in the date, instead of just putting the year, it puts day, month and year. How do I get it to only put the year?

Of course I also want all the metadata (genre, etc) for all my music obviously and the album covers.

I hope you can help me with this and with more recommendations that you have based on your experience.

PS: Please do not speak to me as if I know about the subject, treat me gently.

Thank you very much.

1 Like

First off, welcome to the MusicBrainz community. I think you’ll find that in general we’re a pretty friendly group that try to help.

I’ll include a suggested starting point below, but I also want to mention that there is a pretty comprehensive on-line Picard User Guide which also includes a simple tutorial on Writing a file naming script. If you haven’t had a chance to have a look at this, you might want check it out when you have some time.

The scripting (both tagging and file naming) is one of the strengths of Picard and can range from simple one-liners to quite complex. For example, the file naming script that I developed for use in managing my music library is over 450 lines long (including embedded documentation), and uses different directory structures depending on the type of album (such as Various Artists collections, soundtracks, singles, classical, etc.) If you are interested in having a look, it is posted on GitHub.

Now, to address your original questions…

As a starting point for your file naming script, you might try something like (warning: untested code follows):

%albumartist%/$left($if2(%date%,%originaldate%,0000),4) - %album%/$num(%tracknumber%,2) - %title%

The list of available tags can be found in the Tags & Variables section of the User Guide, and the available scripting functions are listed in the Scripting Functions section (with links to detailed descriptions for each function).

For the metadata information, you should review the configuration settings in the Metadata Options page and its Genres sub-page. The coverart settings are found in the Cover Art Options page. Both are found in Picard’s Option Settings.

I hope this helps get you started. If you have any questions, please don’t hesitate to ask.

6 Likes

Thanks a lot for your kinds words, for your guidness and for the script that works GREAT. I´ll read all that you gave me right now. Thanks a lot.

5 Likes

Small tip… before you start renaming anything, make a backup. While learning how best to use Picard it is easy to make a mistake. So backup first.

Work in small batches, check the results. That way you’ll get the best of results. Also it lets you learn by mistakes as you go along.

3 Likes

I´ve been doing that. Thanks.