
# within same directory  sub directories - 

#!/bin/bash

{
echo "Total files: $(find "$(pwd)" -type f | wc -l)"
echo

echo "FILE COUNT BY TYPE"
echo "=================="

find "$(pwd)" -type f -printf '%f\n' |
awk '
{
    n=$0
    if (n !~ /\./) ext="[no extension]"
    else {
        sub(/^.*\./, "", n)
        ext="." tolower(n)
    }
    count[ext]++
}
END {
    for (ext in count)
        print ext, count[ext]
}' | sort

echo
echo "FILES LARGER THAN 25 MB"
echo "======================="

find "$(pwd)" -type f -size +25M -printf '%s %p\n' |
sort -nr |
numfmt --field=1 --to=iec

} | tee large-files.txt

} | tee large-files.txt
