Brooks Davis wrote:
> > I have a system where I need/want to handle lots of files in a single
> > directory.  Lots as in 100-200K files.  ls | wc -l breaks because the
> > value of ARG_MAX in sys/syslimits.h is too small.  If I change it from
> > 65536 to 4meg and rebuild the world it works fine.
> 
> ls | xargs wc -l
> 
> would work with an arbitrary number of files.

No, it wouldn't.  First off, you would be line counting the file
contents, not the number of files.  Second, the "ls" command alone
will *never* hit ARG_MAX, and neither will "wc -l", if it's pipe'd
to to count the number of files.  He's obviously using a globbing
expression he's not telling us about, and the message is from the
shell expasion of the expression.

Thirdly, even if it was the number of lines in the files he wanted
to count, the totals will be off if xargs were to invoke "wc -l"
multiple times, so the command as written can't work anyway.

-- Terry

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to