Jon Nichols wrote:
> when i want to nuke a huge number of files in a given directory, i will usually use 
>globbing, something like, 'rm *March*'
> 
> sometimes, in directories with hundreds of thousands of files
> i'll try a big glob rm and get an error like 'Arguments too long'.

find . -name '*March*' -exec rm {} \;
or:
find . -name '*March*' -print | xargs rm 

Be aware that using find in this way will not only nuke '*March*' in the
current directory, but subdirectories as well.  If you want to change
that, use:
find . -maxdepth 1 ....

You might want to set up an alias if you use it a lot.  Put this in your
bashrc, if you use bash:

bigrm() {
        find . -maxdepth 1 -name "$1" -print | xargs rm
}

use: bigrm '*March*'
The quotes are important.

> What determines how long that argument list can be, and could it be temporarily 
>changed for similar purposes?

I think it's fixed (set at compile time).  Not certain, though...

MSG


-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to