Skip to content

Latest commit

 

History

History
34 lines (19 loc) · 690 Bytes

count_files_recursively.md

File metadata and controls

34 lines (19 loc) · 690 Bytes

Count all files in a directory, recursively

Count files in current folder, not recursive:

ls -1 | wc -l

Count files only:

find . -type f | wc -l

Count files and directories:

find . | wc -l

Count directories only:

find . -type d | wc -l

Now look at this:

~/.nuget$ find . -type f | wc -l
5259
~/.nuget$ find . | wc -l
10182

The .nuget folder has 5259 files. Even worse... it has almost as many directories as folders!

Source

See also