We will use the find command which is used to search for files in a directory hierarchy together with wc command which prints newline, word, and byte counts for each file, alternatively data read from standard input.
Source: LXer – How to Find Number of Files in a Directory and Subdirectories