|
file count with a twist
Hello Everyone,
I am using the korn shell.
I was hoping to find a set of commands to count files in a directory.
I am using:
ls /home/name/abc* | wc -l
This command works fine when a file matches abc* (returns only the file count) , however when no file(s) are found I get something similar to below:
/home/name/abc*: No such file or directory
0
I want only the 0 when a file is not found and not the path or message - 'No such file or directory' .
Can a single unix command accomplish this? Or does a script need to be written?
Thanks in advance.
Robert
|