Here's a command to check how many of each file type (extension) exists in your present directory and subdirectories:
find . -type f | sed -n 's/.*\.//p' | sort | uniq -c | sort -nr
Example output, ran on my photos directory:
34902 JPG 25068 HEIC 1160 MOV 1144 jpg 398 JPEG 128 tif 112 PNG 66 AVI 62 DNG 14 png 11 mp4 11 heic 7 MPG 6 MP4 5 mov 2 wmv 2 jpeg 2 3gp 1 3GP
If you want the list to be case insensitive, such that jpg
and JPG
files count as the same extension, add a pipe to tr
in the command:
find . -type f | sed -n 's/.*\.//p' | tr '[:upper:]' '[:lower:]' | sort | uniq -c | sort -nr
Case insensitive output:
36046 jpg 25079 heic 1165 mov 400 jpeg 128 tif 126 png 66 avi 62 dng 17 mp4 7 mpg 3 3gp 2 wmv
In case you want to exclude subdirectories, use the -maxdepth
option:
find . -type f -maxdepth 1 | sed -n 's/.*\.//p' | sort | uniq -c | sort -nr