Delete number/characters in image description

Started by aceknox, January 25, 2016, 09:58:12 AM

Previous topic - Next topic

aceknox

Hi,

I just managed to copy the filenames to the image description via exiftool. Now I have the problem, that the filenames contain numbers, which should not be displayed in the image description.

filename: image_1.jpg -> image description: image_1
filename: image_2.jpg -> image description: image_2
etc

Is there a possibilty to delete the "_1" etc in the image description via exiftool?

thanks
ace

StarGeek

Try this command on a test file to see if it does what you want
exiftool "-imagedescription<${imagedescription;s/_\d+$//}" FileOrDir
* 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).

aceknox

thanks for your help - it worked!!! :)

one other question: how can I delete a number if there is no _ in front of it? eg: "image 1"

thanks
ace

StarGeek

Assuming that you want to remove the space as well, just change the underscore to a space:
exiftool "-imagedescription<${imagedescription;s/ \d+$//}" FileOrDir
* 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).