News:

If this site goes down it is because of the crappy DreamHost web hosting: They will disable your "unlimited traffic" web server if a single bot hammers the site with a moderate load.  If necessary, an alternate ExifTool forum page is available at https://sourceforge.net/p/exiftool/discussion/

Main Menu

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

AlphaTag

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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

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).