ExifTool Forum

ExifTool => Newbies => Topic started by: mmyiookp on April 24, 2021, 08:21:18 PM

Title: Find and delete jpgs with certain text in specific exif fields
Post by: mmyiookp on April 24, 2021, 08:21:18 PM
I have tons of photos that I'm trying to purge out, and easiest way I can think of is by what's in the Description or Creator fields on the jpg files.

Is there a way to find all files that have a certain bit of text in the Description field and just delete those ones only from a directory recursively?
Title: Re: Find and delete jpgs with certain text in specific exif fields
Post by: StarGeek on April 24, 2021, 09:33:17 PM
Exiftool can't delete the files, but you can use the -if option (https://exiftool.org/exiftool_pod.html#if-NUM-EXPR) to list the files names or move them to a temporary folder to be deleted afterwards.

As an example,
exiftool -if "$Description=~/some text/" "-Directory=/path/ToBeDeleted/" /path/to/sourcesfiles/
would move any file that had "some text" (case sensitive) to the  "ToBeDeleted" directory.

One thing to watch for is the fact that there are multiple tags which could hold your "description" or "creator" values.
Title: Re: Find and delete jpgs with certain text in specific exif fields
Post by: mmyiookp on April 27, 2021, 08:45:26 AM
thanks!
Title: Re: Find and delete jpgs with certain text in specific exif fields
Post by: StarGeek on April 27, 2021, 11:31:57 AM
For completeness, here's the Reddit thread (https://old.reddit.com/r/linuxquestions/comments/mxw0tu/find_and_delete_jpgs_with_certain_text_in/).