that Sam guy

Favourite linux single line command…

Whenever you have pesky windows users on your network, your file system on any servers running samba start to gain extra, silly, “Thumbs.db” files.

If you’re like me and hate the things with a vengeance, you can get rid of every single one of them using the linux command line below.

updatedb;for i in `locate Thumbs.db|sed 's/ /\__/g'`;do rm -vf "`echo $i | sed 's/__/\\ /g'`";done;

Update 21 Oct 2009: added for loop with sed commands to safety handle spaces, round brackets and single quotes etc. in the file path


Categorised as: Linux


2 Comments

  1. ecigar says:

    Very nice post. I agree 100%.

  2. James Leckie says:

    Also you could use this..

    find / -type f -name “Thumbs.db” -exec rm -f {} \;

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>