Hi,
I'm running GNOME as desktop, and my ~/.thumbnails directory increased to 40 Mbyte. Is there a utility to remove unused/unneeded entries?
Regards
Joachim Backes
On Wed, 28 Oct 2009 08:46:05 +0100 Joachim Backes wrote:
Is there a utility to remove unused/unneeded entries?
I just remove all of the files under ~/.thumbnails as part of the script that backs up my home directory every night (prior to the start of the actual backup, of course).
They get recreated when they are next required anyway.
Michael Schwendt:
Have you heard about "tmpwatch" before?
Hmm, I hadn't thought about using that to clear away personal files. I've occasionally wiped out that directory, but hadn't looked at it recently. I see mine's wasting lots of drive space:
~]$ du -h .thumbnails/ 560M .thumbnails/large 361M .thumbnails/normal
Sounds extreme, but then I do a lot of photography work.
Tim wrote:
Hmm, I hadn't thought about using that to clear away personal files. I've occasionally wiped out that directory, but hadn't looked at it recently. I see mine's wasting lots of drive space:
~]$ du -h .thumbnails/ 560M .thumbnails/large 361M .thumbnails/normal
Sounds extreme, but then I do a lot of photography work.
When disk costs fractions of pennies, is that amount of space even a concern? I've had my thumbnails dir grow over several GB before, after moving my photos to new locations. sing the thumbnails are stored based on the md5 of the path to the image, I ended up duplicating a lot of thumbnails.
I believe recent nautilus will try to clean up old/invalid thumbnails, but I don't use nautilus so I've not tested that.
It is pretty simple to whip up a script to delete thumbnails for files that don't exist anymore. Here's a little bit of python that might be a start for anyone interested. This only checks the normal size thumbnails, but would be easy to tweak so it checks large ones as well (I didn't have any large thumbnails when I wrote it).
#!/usr/bin/python -tt
import os import sys import Image import optparse from urllib import unquote from urlparse import urlsplit
default = { 'dryrun': False, 'skip_netpaths': False, 'thumbdir': os.path.expanduser('~/.thumbnails'), 'verbose': 0, }
usage = '%prog [options]' parser = optparse.OptionParser(usage=usage) parser.add_option('-n', '--dry-run', dest='dryrun', action='store_true', default=default['dryrun'], help='Perform a trial run with no changes made [%default]') parser.add_option('-N', '--skip-netpaths', dest='skip_netpaths', action='store_true', default=default['skip_netpaths'], help='Skip paths on common network file systems') parser.add_option('-t', '--thumbdir', dest='thumbdir', default=default['thumbdir'], metavar='dir', help='Thumbnail directory [%default]') parser.add_option('-v', '--verbose', dest='verbose', action='count', default=default['verbose'], help='Be verbose (may be used more than once) [%default]') opts, args = parser.parse_args()
def error(msg): print >> sys.stderr, msg
def is_netpath(path): """Poor man's test for common network filesystem paths.""" for netpath in ('/net', '/smb'): if path.startswith(netpath): return True return False
thumbs = [os.path.join(path, f) for path, dirs, files in os.walk(opts.thumbdir) for f in files if 'normal' in path and f.endswith('.png')]
bad = {} skipped = {} for thumb in thumbs: try: thumburi = Image.open(thumb).info['Thumb::URI'] except KeyError: error('No "Thumb::URI" field in %s' % thumb) continue except IOError, error: error('%s: %s' % (error.strerror, thumb)) continue
scheme, netloc, path, query, fragment = urlsplit(thumburi)
if scheme != 'file': continue
path = unquote(path)
if is_netpath(os.path.realpath(path)) and opts.skip_netpaths: skipped[thumb] = path continue
if not os.path.exists(path): bad[thumb] = path if not opts.dryrun: try: os.remove(thumb) except OSError, e: error('Failed to remove "%s": %s' % (thumb, e.strerror)) continue
print 'Total thumbnails: %d' % len(thumbs) print 'Bad thumbnails: %d' % len(bad) print 'Skipped thumbnails: %d' % len(skipped)
if opts.verbose: for thumb, path in sorted(bad.items(), key=lambda x: x[1]): print '%s -> %s' % (thumb, path)
Tim:
~]$ du -h .thumbnails/ 560M .thumbnails/large 361M .thumbnails/normal
Sounds extreme, but then I do a lot of photography work.
Todd Zullinger:
When disk costs fractions of pennies, is that amount of space even a concern?
It is, when you don't want to keep wasting money on more hard drives, or you're using a laptop. And I accidentally truncated that pasting.
du -h .thumbnails/ 560M .thumbnails/large 361M .thumbnails/normal 1.9M .thumbnails/fail/gnome-thumbnail-factory 2.0M .thumbnails/fail 923M .thumbnails/
It's keeping "failed" thumbnails. I can't see a good reason for doing that. And that's a rather huge amount of drive space.
I believe recent nautilus will try to clean up old/invalid thumbnails, but I don't use nautilus so I've not tested that.
Doesn't seem to.
It is pretty simple to whip up a script to delete thumbnails for files that don't exist anymore.
In my case, it's probably sufficient to just delete them at the end of a session. I usually only care about rapid browsing during a session, the start-up isn't that important.
On Wed, Oct 28, 2009 at 11:39:01 -0400, Todd Zullinger tmz@pobox.com wrote:
When disk costs fractions of pennies, is that amount of space even a concern? I've had my thumbnails dir grow over several GB before, after moving my photos to new locations. sing the thumbnails are stored based on the md5 of the path to the image, I ended up duplicating a lot of thumbnails.
Backed up storage isn't nearly as cheap as throw away storage. Disk bandwidth has not been keeping up with disk size. It isn't getting cheaper to back up disk space at nearly the rate that plain disk space has.
On 10/28/2009 01:47 PM, Bruno Wolff III wrote:
On Wed, Oct 28, 2009 at 11:39:01 -0400, Todd Zullingertmz@pobox.com wrote:
When disk costs fractions of pennies, is that amount of space even a concern? I've had my thumbnails dir grow over several GB before, after moving my photos to new locations. sing the thumbnails are stored based on the md5 of the path to the image, I ended up duplicating a lot of thumbnails.
Backed up storage isn't nearly as cheap as throw away storage. Disk bandwidth has not been keeping up with disk size. It isn't getting cheaper to back up disk space at nearly the rate that plain disk space has.
Use gconf-editor to set:
/desktop/gnome/thumbnail_cache/maximum_age in days
/desktop/gnome/thumbnail_cache/maximum_size in MB
The default is 180 days and 512 MB. However, fspot overwrites these default to much larger values if present.
This is a feature of gnome-settings-daemon (the "housekeeping" plugin). The purge should occur a few minutes after each log-on.
- Mike
Use gconf-editor to set:
/desktop/gnome/thumbnail_cache/maximum_age in days
/desktop/gnome/thumbnail_cache/maximum_size in MB
Also, the paranoid will be pleased to know that you can set these values to 0, in which case the cache will be cleared upon logout.
Setting them to -1 disables cache cleaning.
- Mike
Dr. Michael J. Chudobiak wrote:
On 10/28/2009 01:47 PM, Bruno Wolff III wrote:
On Wed, Oct 28, 2009 at 11:39:01 -0400, Todd Zullingertmz@pobox.com wrote:
When disk costs fractions of pennies, is that amount of space even a concern? I've had my thumbnails dir grow over several GB before, after moving my photos to new locations. sing the thumbnails are stored based on the md5 of the path to the image, I ended up duplicating a lot of thumbnails.
Backed up storage isn't nearly as cheap as throw away storage. Disk bandwidth has not been keeping up with disk size. It isn't getting cheaper to back up disk space at nearly the rate that plain disk space has.
Use gconf-editor to set:
/desktop/gnome/thumbnail_cache/maximum_age in days
/desktop/gnome/thumbnail_cache/maximum_size in MB
The default is 180 days and 512 MB. However, fspot overwrites these default to much larger values if present.
This is a feature of gnome-settings-daemon (the "housekeeping" plugin). The purge should occur a few minutes after each log-on.
Considering I log in about once a month, that won't do for me.
I have a cronjob that runs this script I got some years ago:
#!/bin/sh find ~/.thumbnails -type f -atime +30 -exec rm {} ;
But I don't even remember how I set up the cronjob to run daily! It is, as this system is rather clean in its ~/.thumbnails
On Thu, Oct 29, 2009 at 3:53 PM, Robert Moskowitz rgm@htt-consult.com wrote:
Dr. Michael J. Chudobiak wrote:
[cut]
Considering I log in about once a month, that won't do for me.
I have a cronjob that runs this script I got some years ago:
#!/bin/sh find ~/.thumbnails -type f -atime +30 -exec rm {} ;
But I don't even remember how I set up the cronjob to run daily! It is, as this system is rather clean in its ~/.thumbnails
I use the excellent tool bleachbit (http://bleachbit.sourceforget.net) (rpms are provided) which frees you from many temp/auxiliary files
First time I ran I got back 1GB of space!!
Cheers,
-- Marco
I use the excellent tool bleachbit (http://bleachbit.sourceforget.net) (rpms are provided) which frees you from many temp/auxiliary files
Ughh, that's not the right URL. That's a spamming pop-up nightmare.
You probably meant: http://bleachbit.sourceforge.net/
- Mike
On Thu, 29 Oct 2009 12:38:28 -0400 Dr. Michael J. Chudobiak wrote:
You probably meant: http://bleachbit.sourceforge.net/
It's apparently available from the standard Fedora repository too.
"yum info bleachbit" tells me all about it.
Dr. Michael J. Chudobiak wrote:
I use the excellent tool bleachbit (http://bleachbit.sourceforget.net) (rpms are provided) which frees you from many temp/auxiliary files
Ughh, that's not the right URL. That's a spamming pop-up nightmare.
You probably meant: http://bleachbit.sourceforge.net/
Wow! And such a simple typo too! At first, I did not even see the difference.....