limit to number of files seen by ls?

Mel Flynn mel.flynn+fbsd.questions at mailing.thruhere.net
Sun Jul 26 08:45:34 UTC 2009


On Saturday 25 July 2009 23:34:50 Matthew Seaman wrote:

> It's fairly rare to run into this as a practical
> limitation during most day to day use, and there are various tricks like
> using xargs(1) to extend the usable range.  Even so, for really big
> applications that need to process long lists of data, you'ld have to code
> the whole thing to input the list via a file or pipe.

ls itself is not glob(3) aware, but there are programs that are, like scp. So 
the fastest solution in those cases is to single quote the argument and let 
the program expand the glob. for loops are also a common work around:
ls */* == for f in */*; do ls $f; done

Point of it all being, that the cause of the OP's observed behavior is only 
indirectly related to the directory size. He will have the same problem if he 
divides the 4000 files over 4 directories and calls ls */*.
-- 
Mel


More information about the freebsd-questions mailing list