Delete more than one month old thumbnails from home directory

find ~/.thumbnails/ -type f -atime +30 -print0 | xargs -0 rm
By time thumbnail images in ~/thumbnails take up too much space, this command will help deleting old ones. Find options explained: -type f : find files only, not directories -atime +30 : last accessed more than 30 days ago

2009-03-30 04:23:07

These Might Interest You

  • This produces a parseable output of the last day of the month in future or past. Change the '-v-0m' to be a month plus or minus from the current system time. Show Sample Output

    date -j -v1d -v-0m -v-1d +'%m %d %Y'
    drewk · 2010-03-04 17:47:51 1
  • The files are automatically uncompressed when they reach the destination machine. This is a fast way to backup your server to your local computer while it's running (shutting down services is recommended). A file named "exclude.txt" is needed at /tmp/ containing the following : /dev/* /media/* /mnt/* /proc/* /sys/* /tmp/* /home/*/.local/share/Trash /home/*/.gvfs /home/*/.cache /home/*/.thumbnails /etc/fstab /lib/modules/*/volatile/.mounted /var/run/* /var/lock/* /var/tmp/* /var/cache/apt/archives/* /lost+found/* Show Sample Output

    tar -cj / -X /tmp/exclude.txt | cstream -v 1 -c 3 -T 10 | ssh user@host 'tar -xj -C /backupDestination'
    fantleas · 2014-07-21 18:52:19 0
  • Combs through your home directory and destroys all Vagrant boxes.

    find $HOME -type d -name .vagrant | xargs -i% bash -c "pushd %; cd ..;vagrant destroy -f; popd"
    gtirloni · 2016-10-06 17:02:20 0
  • Choosing your year and month. You only need the gnu date command and bash. desiredDay of the week is (1..7); 1 is Monday. If you want desiredDay of week (0..6); 0 is Sunday desiredDay=6; year=2012; month=5; n=0; while [ $(date -d "$year-$((month+1))-1 - $n day" "+%w") -ne $desiredDay ]; do n=$((n+1)); done; date -d "$year-$((month+1))-1 - $n day" "+%x" Show Sample Output

    desiredDay=6; year=2012; month=5; n=0; while [ $(date -d "$year-$((month+1))-1 - $n day" "+%u") -ne $desiredDay ]; do n=$((n+1)); done; date -d "$year-$((month+1))-1 - $n day" "+%x"
    ClashTheBunny · 2012-05-17 12:02:30 0

What Others Think

You can already set a space quota, and also maximum age for Nautilus thumbnails with gnome config editor. Easier ;)
CodSpirit · 481 weeks and 4 days ago
hmm, good one my thumbnails folder was over 450MB now cron will keep eye on it :)
sander85 · 481 weeks and 4 days ago
find ~/.thumbnails/ -type f -atime +30 | xargs rm -f
sander85 · 481 weeks and 4 days ago
Plus, you don't need to pipe it to xargs: find ~/.thumbnails/ -type f -atime +30 -exec rm {} +
goodevilgenius · 481 weeks and 4 days ago
Actually, I forgot, find has a delete action: find ~/.thumbnails/ -type f -atime +30 -delete
goodevilgenius · 481 weeks and 4 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: