Filename scripting help needed

I'm working on scripting a means of renaming my digital movies collection. I'm fairly new to the scripting functionality and need some help getting my filenames renamed a certain way. I need the filenames formatted like so:

%title% [%year%]

There are a couple of hurtles to overcome though. I need the script to change the filename to the embedded title first, then I need it to add the year in brackets ([%year%]) if the year is not already present in the filename. I can get a script that renames the filename to the title and another to add the year, but I need them both done simultaneously. I also need to know how character escaping works in Mp3Tag as I cannot get the brackets to appear around the year in the filename and I need the title to overwrite the original filename as it seems to keep the original filename in addition to adding the title name.

Here is the script I have had the best luck with so far:

unknown

You should build the filename from the tagfields in any case, even if the filenames are already correct with the year.

Your format string for the converter is:
%title%[ '['%year%']']

With '[' and ']' the brackets get escaped so that they show up. All that is embedded in non-escaped brackets is only taken if the placeholder %year% is present in the file.

1 Like

Thank you, this worked exactly as I needed.