Fix Destination Path Too Long

I'm during a batch action to rename sub-folders based on the parent_directory using the following action

%_parent_directory%,7) - Artwork

While runnig the action, I often get an error msg:

The filename would be too long for the destination folder.

I created this action "$cutRight(%_parent_directory%,7) - Artwork" thinking It will resolve the issue but in some cases it doesn't.

Is it possible to create an action that implies:

If Parent_directory & filename are too long... delete as many characters as need to rename folder.

Thanks

see e.g. this thread: /t/16455/1

Note: This string has 10 characters: " - Artwork"

DD.20170430.1940.CEST