[fedora-list] What the hell are these dirs?

Rich Mahn rich at lat.com
Sun Jul 26 12:32:08 UTC 2009


===snip====

> BTW, I'm running this command, as suggested by an earlier poster:
> 
> find . -type f -exec rm -fv '{}' +

This is extremely inefficient.  It spawns a process for every file.
With as many files as you have this will take days.

This is better:

find . -type f -print0 |xargs -r -0 rm -f

It spawns a process as if fills up the maximum size command line.
Probably hundreds of times faster than the original.

or this:

find . -depth -type d -print0 |xargs -r -0 rm -Rf

Which deletes directories and is much faster than the previous.

but I expect this is best:

find . -depth -delete

or if you want to see them fly on you screen

find . -depth -print -delete

Your original find did not delete the directories, just the files in
them.  Is that what you want?  Or did you want to delete the directories
as well.  If you want to preserve the directory structure, then this is
probably what you want:

find . -depth -type f -delete
or
find . -depth -type f -print -delete
to watch them go away.

Good luck

Rich
-------------- next part --------------

No virus found in this outgoing message.
Checked by AVG - www.avg.com 
Version: 8.5.392 / Virus Database: 270.13.30/2262 - Release Date: 07/25/09 18:01:00


More information about the fedora-list mailing list