find . -type f -printf "%f\n" | awk -F. '{print $NF}' | sort | uniq -c
find . -type f -printf "%f\n": This finds all files (-type f) in the current directory (.) and prints only their names (%f) followed by a newline.awk -F. '{print $NF}': This usesawkto extract the file extensions by splitting each filename at the dot (.) and printing the last field ($NF).sort: This sorts the file extensions alphabetically.uniq -c: This counts the occurrences of each unique file extension.
This command will output a list showing the count of each file type in the current directory. Adjust the starting directory in the find command (. in this example) if you want to search in a different directory.
No comments:
Post a Comment
Thank you for Commenting Will reply soon ......