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

Re: Length of argument list



This is the wrong way to count files in the first place; any matching file
names containing newlines (yes, they're legal) would give the wrong count.

One alternative is

    a=( manyfiles/* )
    echo ${#a}

to create an array containing all the file names, then check the number of
elements in the array.

On Wed, Jun 10, 2015 at 2: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?
>
>
>
> --
> Manfred
>


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