Replacing all "-" dashes with spaces when copying Filename field to AltText...

Started by AlphaTag, November 18, 2022, 06:54:06 AM

Previous topic - Next topic


I am copying the content in the filename to the AltTextAccessibility field and I want to remove the "-" dashes and replace them with spaces.

The filenames have dashes "models-decision-..." and I want to replace the dashes when I move, so, "models decision ..."

This code works to replace the AltTextAccessibility with the filename.

exiftool *.ai *.psd *.jpg *.jpeg *.png "-AltTextAccessibility<${filename;s/\..*?$//}"

What can I do to change this code so that it will replace all dashes with spaces during the move? Thank you.

Phil Harvey

exiftool *.ai *.psd *.jpg *.jpeg *.png "-AltTextAccessibility<${filename;s/\..*?$//;tr/-/ /}"
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).


Or if using ver 12.22+
exiftool *.ai *.psd *.jpg *.jpeg *.png "-AltTextAccessibility<${Basename;tr/-/ /}" /path/to/files/
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).