in reply to Re: how to get total numbers of files in a directory?
in thread how to get total numbers of files in a directory?

-maxdepth is not implemented on all versions of find. beware. a suitable replacement for getting the number of *.txt files in the current directory is  ls | egrep '\.txt$' |wc -l with the caveat that directory names that end in .txt will be falsely listed in the count.


-Waswas

Replies are listed 'Best First'.
Re: Re: Re: how to get total numbers of files in a directory?
by /dev/null (Chaplain) on Dec 10, 2003 at 01:46 UTC
    This would miss hidden files. Maybe ls -lad *.txt | grep -v ^d | wc -l would be a better solution.

    /dev/null