%_folder%?


#1

First of all, thanks for a great piece of software!! I haven't used it for long, but I can already see a lot of good functionality. :slight_smile:

Now, to my question. Is there or will there be support for %_folder%, just like there is for %_filename%? In my searches I couldn't find anything mentioned about this previously.

My problem is this; I have a boat load of directories that end with "[catalog number]" (without quotes), to whose files I want to append the "[catalog number]" string to the comment field. I have found a solution that is a little cumbersome, and I think I would be able to achieve this much easier if there was a %_folder% scripting variable. (Or, why not %_folder% for immediate parent folder and %_folders% for the full path, but I digress...)

My solution:

  1. Perform a Filename - Filename conversion with the following settings:
    Old filename pattern: %1\%2
    New filename pattern: %2!!!$mid(%1,$strstr(%1,'['),$add(1,$sub($len(%1),$strstr(%1,'['))))

This renames the file(s) by appending three exclamation marks (!!!) followed by the catalog number in brackets to the end of the basename of the filename.

  1. Perform a user defined action with the following settings:
    Action: Format value
    Field: "COMMENT"
    Formatstring: $iflonger(%comment%,0,%comment%. ,)$mid(%_filename%,$add($strstr(%filename%,'!!!['),3),
    $sub($len(%_filename%),$add($strstr(%_filename%,'!!!['),2)))

This grabs the catalog number in brackets from the end of the filename and appends it to the end of the comment, inserting a period in between if no previous comment exists.

  1. Perform a Filename - Filename conversion with the following settings:
    Old filename pattern: %1!!![%2
    New filename pattern: %1

This renames the file(s) to their original name. This all relies on the fact that none of my filenames or folders have three consecutive exclamation marks followed by an open bracket in them (!!![).

Is there a better solution than this and/or can we expect to see extra scripting variables in future releases?


#2

Well, MP3Tag already contains some folder related variables. Check out the File name / path info export variables in the help.


#3

Thanks for the prompt response! As I didn't check on the export stuff yet I hadn't realized that those variables existed and that they could also be used for the conversion actions. I'll give it a try! :slight_smile:

EDIT: Yup, I needed only a modified version of step 2 above. Excellent!