ExifTool Forum

ExifTool => Newbies => Topic started by: terrypin on March 30, 2013, 05:20:02 AM

Title: Deleting corrupted comments?
Post by: terrypin 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
Title: Re: Deleting corrupted comments?
Post by: Phil Harvey 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
Title: Re: Deleting corrupted comments?
Post by: terrypin 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
Title: Re: Deleting corrupted comments?
Post by: Phil Harvey 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
Title: Re: Deleting corrupted comments?
Post by: terrypin 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