2

I want to search for PNG's in a (sub-)folder structure with the meta tag software set to the value GNOME::ThumbnailFactory and delete them with a single bash command.

Have the story behind it, you can skip that if you want:
I scrapped my Ubuntu ext filesystem by formatting the drive, and then decided to save my files with PhotoRec. My problem now is that now I have all my files wildly distributed in some sub-folders, and guess it, the hidden Gnome Thumbnail folder is also evenly distributed in it and way larger than the original files because it also indexed my external harddrive I had mounted on it sometimes. I found out all of them had the PNG Software Tag set to the GNOME::ThumbnailFactory value by looking at some of them with ExifToolGUI in Windows, but I'm not able to find out how I can do that and delete them according to the results with a Linux Command Line Tool, and I'm not very proficient with grep to be honest.

1

You can do this using ImageMagick. Once ImageMagick is installed, use command identify -verbose image.jpg and pick what you want from the output using grep

find / -name "*.png" -exec sh -c '
  if identify -verbose "${file}" | grep your_pattern_here
  then
    echo "${file}" # or do something else here, e.g. rm
  fi
' {} \;
  • Doesn't that only put the result for one image? I want to search them according to said tag – uncanny Mar 8 '16 at 14:56
  • Yeah... that is what a for loop for. You can loop through files one by one, as it should be done. See my updates in the answer above – MelBurslan Mar 8 '16 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.