Hi everybody I'm trying to remove all thumbs.db files in a Windows partition using find command in ubuntu:
find . -iname "*.db"|while read junk;do rm -rfv $junk;done
But it's not working for me and nothing happens! I did this trick to remove my junk files before on previous version of Ubuntu but now on latest version of Ubuntu I can't. Is there any bug in my command?
I'd do it this way:
This way, it still works even if your directories contain whitespace in their names.
First check if the first part of your command, that is:
is returning anything.
If it does then you can use
xargs
as follows to accomplish your task:UPDATE: From comments, this is unsafe, specially if there are spaces in directory/file names. You will need to use
-print0
/xargs -0
to make it safe.just to throw this out there
I'm not sure why you're using
while
....should suffice (and only delete the files you want to, not any BDB files that may be laying around).
The code looks good and works on arch and debian. Maybe there are no files matching "*.db"?
As a sidenote: I might not be a good idea to delete all files with the suffix ".db", because you can accidently delete other files than "Thumbs.db"