42 character field length instead of 64


#1

I need to reduce the file length to 42 characters in length (incl. extension).

How can I format the Action line?


#2

I think something like this should work:

$mid(%_filename_ext%,1,$sub(42,$add($sub($len(%_filename_ext%),$strrchr(%_filename_ext%,.)),1)))

#3

Another approach:

$left(%_FILENAME%,$sub(42,$sub($len(%_FILENAME_EXT%),$len(%_FILENAME%))))$right(%_FILENAME_EXT%,$sub($len(%_FILENAME_EXT%),$len(%_FILENAME%)))

will give the filename including extension.

$left(%_FILENAME%,$sub(42,$sub($len(%_FILENAME_EXT%),$len(%_FILENAME%))))

will give just the filename.

DD.20061212.1420


#4

Just to freshen up this old thread.

How to shorten the filename to a specific length using Mp3tag Scripting Language?

Goal:
The length of the filename including extension should be 42 characters.
From:
02_YouOughtaKnow~AcousticLive_AlanisMorissette_I_1996.mp3
To:
02_YouOughtaKnow~AcousticLive_AlanisMo.mp3

Solution 1 (will give the filename including extension):

$left(%_filename%,$sub(42,$sub($len(%_filename_ext%),$len(%_filename%))))$right(%_filename_ext%,$sub($len(%_filename_ext%),$len(%_filename%)))

Solution 2:

$mid(%_filename_ext%,1,$sub(42,$add($sub($len(%_filename_ext%),$strrchr(%_filename_ext%,'.')),1)))

Solution 3:

$left(%_filename%,$sub(42,$sub($len(%_filename_ext%),$len(%_filename%))))

Solution 4 (will give the filename including extension, like Solution 1):

$left(%_filename%,$sub(41,$len(%_extension%)))'.'%_extension%

Solution 5:

$left(%_filename%,$sub(41,$len(%_extension%)))

DD.20110308.1455.CET


Why was "Shorten filenames to 64 characters" removed?