42

I have a lot of images on my laptop as I work in graphics. On the same system, I also have a folder containing my family pictures.

I would like to do two things:

  • Empty the already cached images

and then

  • "blacklist" or exclude the folder holding the family pictures as I use Shotwell for organizing/adding/deleting these files

In the settings of Nautilus you can only change global settings.

File Management Preferences preview tab

Any ideas?

Allan
  • 11,672

4 Answers4

58

Thumbnails are stored in ~/.cache/thumbnails. Simply deleting everything in there will reset your thumbnails, causing them to be recreated according to the global settings. I'm afraid I can't think of a way to prevent a specific directory from being thumbnailed.

Note: In Ubuntu 12.04 (Precise Pangolin) and older, the thumbnails are stored in ~/.thumbnails. But please verify this for your own distro. Lubuntu 12.10 (a clean install) has its thumbnails in ~/.thumbnails and there is no thumbnails subfolder in ~/.cache.

Scaine
  • 11,229
6

BleachBit can wipe your thumbnail cache, I believe. Not sure how to blacklist a folder from getting thumbnails, though.

Jonathan
  • 7,470
1

remove thumbnail if the original file does not exist:

cd ~/.cache/thumbnails
find large normal -type f |
perl -MImage::Magick -MURI::Escape -lne '
    $, = "\t";
    $f = $_;
    $img = Image::Magick->new;
    $img->Read($f);
    $u = $img->Get("%[Thumb::URI]");
    $p = uri_unescape $u;
    $p = substr $p, 7;
    next if -f $p;
    print "rm", $f, $p;
    unlink $f;
'
gholk
  • 31
1

thumbnails are stored on $HOME/.cache/thumbnails. It is a md5sum from file URI and time comparison from your-file and generated thumbnail

That's why touch your-file cause thumbnail to be recreated.

If you don't want to change your file in any way, you can search using md5:

clean-thumbnail-cache

#!/bin/bash

#set -xv

MD5SUM=$(echo -n file://$PWD/$1 | md5sum | awk '{ print $1 }')

find $HOME/.cache/thumbnails -name $MD5SUM.png -exec rm -v {} ; | grep "."

if [ $? != 0 ] then echo thumbnail not found fi

Put on PATH and call it with:

clean-thumbnail-cache your-file

See this is not throughly tested (sym links, files with spaces, etc...)

albfan
  • 151