Artem

Artem's blog / Show files statistics in Mac Terminal

This is a simple command to show files statistics in Mac Terminal. It shows the number of folders, the total number of files and the number of files by extension. It analyzes the current directory and all its subdirectories.

{
    echo "Folders:" && find . -type d | wc -l;
    echo "Files total:" && find . -type f | wc -l;
    echo "Files by ext:";
    find . -type f | awk -F. '/\./ {print tolower($NF)}' | sort | uniq -c | sort -nr;
 }

Here is an example of the output:

Picture 1