View previous topic :: View next topic |
Author |
Message |
kg4ysy Apprentice
Joined: 08 Jul 2006 Posts: 183 Location: North Carolina
|
Posted: Tue Aug 08, 2006 2:58 am Post subject: Remove Windows Thumbs.db |
|
|
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 |
|
|
i92guboj Bodhisattva
Joined: 30 Nov 2004 Posts: 10315 Location: Córdoba (Spain)
|
Posted: Tue Aug 08, 2006 3:37 am Post subject: |
|
|
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). |
|
Back to top |
|
|
vandalman n00b
Joined: 16 Mar 2005 Posts: 52
|
Posted: Tue Aug 08, 2006 6:29 pm Post subject: |
|
|
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 |
|
|
chrbecke Guru
Joined: 12 Jul 2004 Posts: 598 Location: Berlin - Germany
|
Posted: Tue Aug 08, 2006 8:05 pm Post subject: |
|
|
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 |
|
|
|
|
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
|
|