Limitation of ls command

Hi,

Iam using an alias to get the file count from one directory using normal ls command like ls file*|wc -l.If my file increases more than 35,000 ,my alias is not working.It shows that arg list too long.
is that can be limitation of ls or problem in alias?
I would appreciate if anyone can help me.

Regards,
kumar.

I too faced the same problem on unix

http://groups.google.co.in/group/comp.unix.unixware.misc/browse_thread/thread/380294c255f896dc/968210832f3ace9c?lnk=st&q=UX%3Als%3A+ERROR%3A+Out+of+memory%3A+Insufficient+or+invalid+memory&rnum=2&hl=en#968210832f3ace9c

dig up this like it would be helpful for you

thanks
srikanth

First way (grep+wc can be replaced by awk) :

ls | grep 'file*' | wc -l

Second way using find
Count files 'file*' in current directory (no recursive search, only files not directories) :

find . \( -type d ! -name . -prune \) -o  -name 'file*' -print | wc -l

Jean-Pierre.