Ubuntu - count all files in a directory recursively
Ubuntu - count all files in a folder recursively.Took a while to figure out how to do this on a single command, but so very useful to check if all files have copied successfully.find . -type f | wc -l
How this works:find . -type f
finds all files ( -type f ) in this ( . ) directory and shows everything as one file on each line in a list.The second command comes after the pipe | into wc
(word count) the -l
option tells wc to only count lines of its input.Together they count all files in the folder you are in and all sub-folders.