Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Length of argument list

On Wed, 10 Jun 2015 22:09:06 +0200
Mikael Magnusson <mikachu@xxxxxxxxx> wrote:

> On Wed, Jun 10, 2015 at 8:48 PM, Manfred Lotz <manfred.lotz@xxxxxxxx>
> wrote:
> > Hi all,
> > I created 1 million files in a directory callend manyfiles/.
> >
> > Now
> > ls manyfiles/* |wc -l
> >
> > gives
> > zsh: argument list too long: ls
> >
> >
> > Question: Is there a way to change the maximum size of the argument
> > list?
> That depends on your operating system, on linux it is guided by ulimit
> -s (in particular, the argument list is a quarter of the stack size).

Interesting. Didn't know. This works indeed.

Do you know how it is in FreeBSD, for instance?

> On other operating systems, the limit is traditionally quite small.
> I'm assuming the above is just an example, but that particular thing

Yes, just an example. I want to see if it possible to use simple
command when dealing with directories containing many files.

> would be better handled by () { echo $# } manyfiles/*, or some
> xargs/zargs contraption if you want to be more general.

..and for f in *... and things like this.

In the end it means if a directory contains a large number of files
then the usual commands rm, cp, mv etc cannot be used easily without
additional support (find,xargs, for loops etc).


Messages sorted by: Reverse Date, Date, Thread, Author