Cleaning thumbnails from GNOME desktop cache

It's a maexotic world ...


cleanthumbsThe GNOME desktop caches thumbnails of images in a directory hierarchy in $HOME/.thumbnails. However, if the original image is deleted, the thumbnail remains in the cache directory. This can lead to a massive waste of a lot of disk space:
$ du -sm ~/.thumbnails
506 ~/.thumbnails
even more if you frequently use CDROMs with images on them or create, delete and move around images a lot.

Existing solutions found on the web are based on a rather dumb "find -mtime +n" run that deletes all thumbnails older than n days and even the GNOME solution is based on age and cache size, configurable with gconf-editor:

gconf-editor screenshot setting thumbail cache

While this saves disk space it is annoying, as thumbnails of existing images are deleted in favor of younger thumbnails of no longer existing images. This is especially annoying if you have a large archive of images (from a digital camera) and browse directories you haven't viewed quite some time, as all the thumbnails have been deleted and are now recreated.

However, the thumbnails contain the original location of the image they were created from in the comment block. So my script cleanthumbs.py retrieves the location of the original image from all thumbnails and checks for their existance. If the original image is not found, the thumbnail is deleted.

Setting the value of /desktop/gnome/thumbnail_cache/maximum_age to -1 in gconf-editor disables deleting thumbnails by age and if you have quite some disk space and want fast image browsing, also set /desktop/gnome/thumbnail_cache/maximum_size to -1 and run cleanthumbs.py from time to time.

Hope this is helpful.




Comments

    • Posted byneutronenspalter
    • on
    ahhhhhh, great!
    The not-so-clever housekeeping of thumbnails in GNOME really got on my nerves. It was blocking my desktop for roughly two minutes every time I logged in due to excessive disk usage.
    cleanthumbs was even faster and dumped 10000 out of 20000 thumbs, all missed by the build-in routine coming packed with GNOME.

    This is really a relief. Thank you very much.
    Reply
    • Posted bySerge
    • on
    Greeat , 40000 photo in f-spot and some times my thumbnails was not available !!

    I hope that solve my issue !

    Thx

    Serge
    Reply