Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Sep 2002 15:40:51 -0300
From:      Adrian Mugnolo <adrianm@yahoo-inc.com>
To:        Derek <derek@durham.net>
Cc:        Jean-Yves Lefort <jylefort@brutele.be>, questions@FreeBSD.ORG
Subject:   Re: Directory containing many files
Message-ID:  <20020910154051.A2974@jazz.ar.yahoo.com>
In-Reply-To: <018401c258e0$c2165fc0$04fea8c0@motorcity.on.ca>; from derek@durham.net on Tue, Sep 10, 2002 at 11:43:06AM -0400
References:  <20020910132907.1aabde58.jylefort@brutele.be> <018401c258e0$c2165fc0$04fea8c0@motorcity.on.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

> > Can some problems arise by having that many files in one >
> single directory?
> 
> I have had issues with (bash) shell globbing.  For example the
> command:
> 
> rm *
> 
> may return:
> argument list too long

Please note that shell patterns get expanded at the command line level,
not the command themselves [everybody knows that -- but takes quite a
while to figure out].  For big lists you can use xargs(1):

        ls -1 | xargs rm

Or find(1):

        find . -type f -maxdepth 1 -exec rm {} \;
        find . -type f -maxdepth 1 -delete

[Not using some primaries with find(1) can produce unwanted results --
it's recursive unless told otherwise.]

This comes specially handy for makefiles and scripting.

HTH

Regards

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020910154051.A2974>