Wednesday, July 31, 2013

Count number of files in a directory using Linux command

Following command can be used to get number of files in the directory. This "maxdepth" option lets you to define maximum depth (sub directory levels) to search files.

find ./targetdir/ -maxdepth 20 -type f -follow | wc -l