Clean-up KDE Thumbnails

metadata
  • keywords:
    • software
    • KDE
    • bash
    • php
  • published:

KDE creates thumbnails of all your files when you view them in Dolphin or Konqueror. It then saves these thumbnails so that if you look at the photo again it doesn't have to regenerate the thumbnail. This is a really efficient way of doing things. Plus, it stores the thumbnails in a central place instead of, like Windows, leaving little Thumbs.db files around the place. The drawback with the current system is that if you delete a photo then its thumbnail is not deleted along with it. This means that if you simply rename a folder then a huge swathe of saved thumbnails will no longer refer to the correct files - thus being useless. After a while these accumulate and occupy disk space when they really shouldn't.

Version 2

This version is completely unrelated to the first one - it is simply a BASH script that relies on exiftool to do the inspection of the PNG meta-data. This is the one that I run regularly on my Linux boxes. I will leave the old version here too for archival.

Version 1

To quote the comment in the script:

This script will: search for all the saved thumbnails on your KDE system; then check if the original file is present and delete the thumbnail if it is not; or delete the thumbnail if it references the trash can.

I hope this script is useful for you. The first time I ran it it removed 90 MBs of redundant thumbnails for me!