Without the newer (GNU) find versions, like I don't have... I have to resort to using this type of syntax to display files only in the current directory (I don't want it to descend in to sub-directories). Let say there are tons of "xml" files in the current directory.
#Example using find that will count the number of xml files find . \( ! -name . -prune -name "*.xml" \) -type f -print | wc -l
Here is an alternative way to count the files in Perl:
perl -e '@a=<*.xml>;map {print "$_\n";} @a;' | wc -l #Even quicker version perl -e '@a=<*.xml>;printf("%s\n", scalar(@a));'
The caveat for the Perl version is that you would need enough memory to hold the names of the files in the array @a .