ExifTool Forum

ExifTool => Newbies => Topic started by: AlphaTag on November 18, 2022, 06:54:06 AM

Title: Replacing all "-" dashes with spaces when copying Filename field to AltText...
Post by: AlphaTag on November 18, 2022, 06:54:06 AM
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.
Title: Re: Replacing all "-" dashes with spaces when copying Filename field to AltText...
Post by: Phil Harvey on November 18, 2022, 07:45:28 AM
exiftool *.ai *.psd *.jpg *.jpeg *.png "-AltTextAccessibility<${filename;s/\..*?$//;tr/-/ /}"
Title: Re: Replacing all "-" dashes with spaces when copying Filename field to AltText...
Post by: StarGeek on November 18, 2022, 11:03:46 AM
Or if using ver 12.22+
exiftool *.ai *.psd *.jpg *.jpeg *.png "-AltTextAccessibility<${Basename;tr/-/ /}" /path/to/files/