count files linux code example
Example 1: bash how many files in a directory
ls -1q log* | wc -l
Example 2: how to count all files on linux
for i in */ .*/ ; do
echo -n $i": " ;
(find "$i" -type f | wc -l) ;
done
ls -1q log* | wc -l
for i in */ .*/ ; do
echo -n $i": " ;
(find "$i" -type f | wc -l) ;
done