Remove Windows Thumbs.db Files

Daniel Mons daniel.mons at
Fri Nov 7 21:28:20 GMT 2008

Dave Hall wrote:
> First bit of advice - never trust anyone telling you to run "rm -rf"
> find /path/to/windows-files -iname thumbs.db -exec rm -rf {} \;

Technically speaking there is no reason to need the "-r" (recursive)
flag with "rm" when using "find" to find and delete files (as "find"
itself is recursive).  You can also tell "find" to look for files only
with the -type flag, which is recommended in the name of safety and sanity.

And in the name of diversity, here's yet another way to do it (because
there's *always* another way to do it in Linux):

find /path/to/windows/files -type f -iname thumbs.db | while read FILE ;
do rm "${FILE}" ; done

find's -exec is handy, but program-specific.  "while read" is nice and
generic, and can be used with heaps of other stdout outputs too.

And of course you could do it the GUI way - Places -> Search for
Files... do your search, and delete the results found.  But that's
nowhere near as fun as the command line.


More information about the ubuntu-au mailing list