Author Topic: Deleting corrupted comments?  (Read 2197 times)

terrypin

  • Full Member
  • ***
  • Posts: 66
Deleting corrupted comments?
« on: March 30, 2013, 05:20:02 AM »
As I mentioned a while ago, my image editor PaintShop Pro either deletes all metadata or corrupts it whenever the file is saved (even wih no editing). So I have many hundreds of JPGs with a Comment field that now looks like this example (a direct paste from EXifTool output):

Ð.r............................. !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~.€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ        -       -

I'm struggling with this one, so would appreciate help in how to delete all such comments from a folder and its subfolders please.

Edit: Just trying this based on an example in the documentation:

exiftool -exif:all= -tagsfromfile @ -all:all -unsafe -r <FOLDER>

At first it seemed to work, but now getting no changes. Will post again if I sort it...


--
Terry, East Grinstead, UK
« Last Edit: March 30, 2013, 07:13:52 AM by terrypin »

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16910
    • ExifTool Home Page
Re: Deleting corrupted comments?
« Reply #1 on: March 30, 2013, 08:23:48 AM »
Hi Terry,  The command you posted will repair any structural damage to the metadata.  However, it is possible that the comments may contain garbage even if the structure is OK.  In this case, deleting the comments may be the only option, but you will have to be careful not to do this for files where the comments are OK.

- Phil
...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 ($).

terrypin

  • Full Member
  • ***
  • Posts: 66
Re: Deleting corrupted comments?
« Reply #2 on: March 30, 2013, 08:50:08 AM »
Thanks Phil. Coming at it differently, could you give me a basic example of how I could delete a comment IF it contained say <char 1> AND <char 2> please? I'd then write a string of these IFs (specifying several comonly occurring non-printable characters), which I'm sure would get rid of most of the bad comments.

Terry, East Grinstead, UK

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16910
    • ExifTool Home Page
Re: Deleting corrupted comments?
« Reply #3 on: March 30, 2013, 10:47:18 AM »
Hi Terry,

Here is the command:

exiftool -if "$comment =~ /X/ and $comment =~ /Y/" -comment= DIR

Where X and Y are the character strings that you want to match.  Add -r to process sub-directories too.

- Phil
...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 ($).

terrypin

  • Full Member
  • ***
  • Posts: 66
Re: Deleting corrupted comments?
« Reply #4 on: March 30, 2013, 01:45:29 PM »
Thanks Phil, that worked as you described. But I've abandoned that approach as the possible contents of corrupted Comments vary so widely that it's impractical.

I think I'm stuck with visual inspection and quick deletion of Comment in individual files.

--
Terry, East Grinstead, UK