Help with folder and name script

Could someone help me out with a script? I just want
Folder A-Z, #
Folder Artist
Folder album If not an album or various just be placed under artist folder.
file name Artist - Title

that’s it.

thank you for your help

Most simple version:

$firstalphachar(%albumartistsort%)/%albumartist%/%album%/%artist% - %title%

See how this is really just your text above written down with the appropriate variables :slight_smile:

Not sure how you mean this. The above will just create a folder with the album title under the artist folder, which will be “Various Artists” for various. Do you want this different?

1 Like

I want the folder structure strictly as
ie Korn - Am I Going Crazy

K\Korn\issues\Korn - Am I Going Crazy

If it is an various artist album I want it to be
K\Korn\Korn - Am I Going Crazy

and if its a #
ie 2Pac - Heartz of Men
#\2Pac\All Eyez on Me\2Pac - Heartz of Men

If I understand you correctly, I think this might do what you’re after:

$firstalphachar(%artistsort%)/%artist%$if($eq(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377),/%album%)/%artist% - %title%

Its better than anything else I have found. Thanks.

okay so I am trying this… and it is not having the expected result…

its putting things in the wrong place?

Please provide an example or two of the expected result and the erroneous result that you are seeing.

it started putting artist with numbers in separate folders. like 2 pac in folder 2 not in # folder. and in the # folder it had normal artist in it…

Okay, this should take care of the different folders for each non-alpha character.

$firstalphachar(%artistsort%,nonalpha="#")/%artist%$if($eq(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377),/%album%)/%artist% - %title%

As for the normal artist in the “#” folder, can you please let me know which artist? I’m not sure why that would happen, unless it is some side effect from the missing ,nonalpha=“#” part of the function call in my original response.

I was also going to ask about artists that start with The. can you have it move the to the end of the artist name?

Yup.

$firstalphachar(%artistsort%,nonalpha="#")/$swapprefix(%artist%,*prefixes="a","the")$if($eq(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377),/%album%)/%artist% - %title%

This should move it in the directory under the initial, but not in the track directory. Did you want it changed there too?

I’m not understanding. this gave an error

I’m usually good with scripting. but this script just makes no sense to me.

Just checked and it crashes Picard here too. I’ve modified it slightly to the following, which seems to be working.

$firstalphachar($if($eq(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377),%artistsort%,%albumartistsort%),nonalpha="#")/
$swapprefix($if($eq(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377),%artist%,%albumartist%))/
$if($ne(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377),/%album%)/%artist% - %title%

I’ve tested it here on Picard 2.0.beta2 and it seems to do what I think you’re wanting.

Sometimes my code can do that. :slight_smile:

I’ve broken the above script into four logical lines, and I’ll try to explain what’s happening in each of the lines:

$firstalphachar($if($eq(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377),%artistsort%,%albumartistsort%),nonalpha="#")/

The first line creates the letter directory, using the $firstalpha() function. The artist name used to determine the letter is either %artistsort% (if the album artist is Various Artists), otherwise %albumartistsort%.

$swapprefix($if($eq(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377),%artist%,%albumartist%))/

The second line creates the artist directory, using the $swapprefix() function to move “The” or “A” away from the start of the artist’s name. The artist name used is either %artist% (if the album artist is Various Artists), otherwise %albumartist%.

$if($ne(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377),/%album%)/

The third line creates the album directory, but only if the album artist is not Various Artists.

%artist% - %title%

The final line sets the file name to the artist and title for the track.

I hope this helps.

it put the # thing in a folder named nonalpha=# I would like it to be just # or 123

Not sure I understand what you’re asking.

Do you want the “#” directory to only contain names starting with an octothorpe or a digit? If so, how are you expecting to handle names that don’t start with an alpha and don’t start with an octothorpe or a digit?

Do you want separate directories for each digit?

Again, I’m not sure what you’re after.

EDIT: Sorry, now I think I understand. You mean it actually created a directory called “nonalpha=#” Try changing the first line to:

$firstalphachar($if($eq(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377),%artistsort%,%albumartistsort%),#)/

and see if that does what you want.

One more change to the first line to make sure all the letter directory names are upper case:

$upper($firstalphachar($if($eq(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377),%artistsort%,%albumartistsort%),#))/

this program has complete fed up my collections… I am going to just scrap and start over and manually try to fix this mess…

Did you try running just this line, or did you run the whole script with this replacing the first line? The corrected full script is:

$upper($firstalphachar($if($eq(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377),%artistsort%,%albumartistsort%),#))/
$swapprefix($if($eq(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377),%artist%,%albumartist%))/
$if($ne(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377),/%album%)/
%artist% - %title%