Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Remove Windows Thumbs.db
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
kg4ysy
Apprentice
Apprentice


Joined: 08 Jul 2006
Posts: 183
Location: North Carolina

PostPosted: Tue Aug 08, 2006 2:58 am    Post subject: Remove Windows Thumbs.db Reply with quote

Ok so these files although harmless really get on my nerves. I sorta wrote this little bash script that goes through and destroys all instances of the infamous Thumbs.db. It's rough but it gets the job done. I hate those Thumbs.db files.

Code:
#!/bin/bash
locate Thumbs.db > thumbs.db.txt
a=0
while read line
do a=$(($a+1));
echo $line
rm "$line"
done < "thumbs.db.txt"
echo $a Thumbs.dbs removed
rm thumbs.db.txt


--Jim
Back to top
View user's profile Send private message
i92guboj
Moderator
Moderator


Joined: 30 Nov 2004
Posts: 9752
Location: Córdoba (Spain)

PostPosted: Tue Aug 08, 2006 3:37 am    Post subject: Reply with quote

Alternatively, go to any dir of your choice, and

Code:
rm -f `find . -name "Thumbs.db"`


:)

Just an advice, I would revise the list of files to erase, in linux, some programs like to store similar files to this Thumb.db.

Code:
┌─(lun ago 07, 18:58:12)-(i92guboj@pinkroom)-(~)-·
└─[1]-> $ find . -name "Thumbs.db"
./docs/icons/Comps/32/Thumbs.db
./docs/icons/Comps/48/Thumbs.db
./docs/icons/Comps/128/Thumbs.db
./docs/icons/Comps/64/Thumbs.db
./docs/icons/Glaux_glass_icons/128x128/Thumbs.db
./docs/icons/amarok/128x128/Thumbs.db
./docs/icons/amarok/96x96/Thumbs.db
./docs/icons/amarok/48x48/Thumbs.db
./docs/icons/amarok/32x32/Thumbs.db
./docs/icons/amarok/16x16/Thumbs.db
./docs/icons/amarok/64x64/Thumbs.db
./docs/icons/amarok/22x22/Thumbs.db


Though those are, generally, not too important anyway.

EDIT, forgot to mention that the find method is slower, but it does actually "find" all the files, while locate and slocate look into the locate db, which might -or might not- be up to date. Of course, the locate method has the advantage of being way faster, overall if the volume is biiig (only if the locate db is up to date and you dont need to rebuild it).
_________________
Gentoo Handbook | My website
Back to top
View user's profile Send private message
vandalman
n00b
n00b


Joined: 16 Mar 2005
Posts: 52

PostPosted: Tue Aug 08, 2006 6:29 pm    Post subject: Reply with quote

Yet another method, this time using xargs to avoid "too many arguments" errors. This error could potentially come up, because the previous method creates a long listing of files to remove as the arguments. This passes each location to xargs, which actually removes the files. There are a bunch of different methods for doing this, this is how I would do it.

Code:
find . -name Thumbs.db | xargs -I {} rm {}
.
Back to top
View user's profile Send private message
chrbecke
Guru
Guru


Joined: 12 Jul 2004
Posts: 598
Location: Berlin - Germany

PostPosted: Tue Aug 08, 2006 8:05 pm    Post subject: Reply with quote

And another one:
Code:
find . -name "Thumbs.db" -exec rm {} ';'

Shouldn't run into the "too many arguments" error either, and no xargs needed. :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum