Let's say you download some .zip/tar.gz or source-code of a project from somewhere. The result you will get are a random bunch of files, some having code and some having images. Is there a way to get some understanding how much percentage images, media files and how much is a text file ? If there is a tool which does that, please share. If not, how would one go in crafting a script or something which does that ?Update - giving more information due to comments received. Just to state an example, this is what I'm talking about - [shirish@debian] - [~/games/I-Nex] - [10054][$] [$] ll -htotal 236Kdrwxr-xr-x 3 shirish shirish 4.0K 2016-11-13 21:25 debiandrwxr-xr-x 3 shirish shirish 4.0K 2016-11-13 19:16 I-Nexdrwxr-xr-x 2 shirish shirish 4.0K 2016-11-13 19:16 JSONdrwxr-xr-x 3 shirish shirish 4.0K 2016-11-13 02:12 dists-rw-r--r-- 1 shirish shirish 7.8K 2016-11-13 02:12 i2c_smbus.rules-rw-r--r-- 1 shirish shirish 1.4K 2016-11-13 02:12 i-nex.mkdrwxr-xr-x 2 shirish shirish 4.0K 2016-11-13 02:12 manpagesdrwxr-xr-x 2 shirish shirish 4.0K 2016-11-13 02:12 pixmaps-rw-r--r-- 1 shirish shirish   97 2016-11-13 02:12 release.conf-rw-r--r-- 1 shirish shirish  280 2016-11-13 02:12 requirements.md-rwxr-xr-x 1 shirish shirish 1.4K 2016-11-13 02:12 changelog.awk-rwxr-xr-x 1 shirish shirish 2.5K 2016-11-13 02:12 Makefile-rw-r--r-- 1 shirish shirish 6.6K 2016-11-13 02:12 README.md-rw-r--r-- 1 shirish shirish 176K 2016-11-13 02:12 Changelog.mdNow while this example is simple as only pixmaps directory has the pictures/images, it doesn't tell how much space is being consumed by text files and text directories and how much by pixmaps. 
Is there a way to know percentage of images and code in a given directory?
files;disk usage;size
#!/bin/bashfind $1 ! -type d |while read fpath; do    fname=${fpath##*/}    suffix=${fname##*.}    if [[ $suffix == $fname ]]; then        suffix=(none)    fi    size=$( stat --format '%s' $fpath )    printf '%s\t%d\n' $suffix $sizedone |awk '{ sz[$1] += $2 }     END { for (s in sz) { printf(%s:\t%d\n, s, sz[s]) } }'Given a directory on the command line, the above bash script will use stat1 to get the size of each individual file in the directory, and below, in bytes. The while-loop also chops off the suffix for each file and outputs it together with the size of the file (in bytes).The awk script2 at the end will summarize and print the information.Example, running over a directory of one of my work projects:$ bash ./script.sh /home/kk/Work/Development/project/src/c:      4559172am:     369h:      151369o:      4613432in:     42216out:    3282712(none): 2908962Po:     18414txt:    7129The output may then be further filtered and formatted if need be.Modifying this to do percentages of total size, or to use file to get the filetype rather than relying on the filename suffix, or to output the sizes in another unit than bytes, is left to the reader as on exercise.1 The stat call here is tailored for GNU stat from the GNU coreutils package. The stat on OpenBSD is totally different.2 The awk script is assumed to be run by an awk implementation that knows about associative arrays, such as GNU awk or mawk.