Replace a fixed text string (in File Name) with a variable %year%

i have tried all sorts in both Convert and in Actions

this is one example ...

$replace(%filename%,YEAR UNK,%year%)

in this attempt the Year variable was treated as text string

what makes this harder than just appending Year to File Name is that at some point, for SOME files, in an earlier attempt to add year to File name, it didn't work for all, and instead i ended up with a default text string of '(YEAR UNK)', and i can't just append again, because i would end up with a lot that would then have Year twice.

and this raises the question of the technical difference between the Convert function and the Action function: it seems that they are not interchangeable
can variables eg %year% be used in both?
can operators eg $replace be used in both?

%year% can be used where you are expected to enter a format string.

If that is the accurate copy then you have replaced the string "YEAR UNK" with the value from YEAR in the user-defined (and probably non-existent) field FILENAME.
if you want to address the filename, use _FILENAME.
Sometimes, as said in

a screendump helps.

You say that you have used

but you do not tell us which Convert function you used and which action.

The scripting functions can be used effectively in almost all areas of mp3tag where tag editing and filtering is available.

The Actions are key for those sequences that you may be running often, as they can be saved and recalled quickly.

The Convert options are more specific to the way you want to address converting to and/or from tags and filename information. But more importantly they also offer the benefit of a live preview of the conversion using your scripting, so you can confirm if the output will be the intended result.

Either way, it is highly recommended that you start with just a single or smaller batch of files, before unleashing any script on an entire library. And it goes without saying that keeping an active and up to date backup of your library is critical.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.