How many files are there in a directory? Count the number of files in a directory.
Contributed by: Unknown User anonymous2 [01/23/04 | Discuss (0) | Link to this hack]
This is a beginners hack to calculate the number of files in a particular directory.
ls <path> | wc -l
The above command will tell you how many files are listed on the <path> provided.
E.g.
ls /home/user/images | wc -l
will list number of files under images.