Give you something to start, below the script you will get a list of files and their size line by line.
#!/usr/bin/env bash
DIR=ABC
cd $DIR
find . -type f |while read line
do
size=$(perl -e 'print -s $ARGV[0],"\n"' $line )
echo $size $line
done
Output sample
123 ./a.txt
23 ./fds/afdsf.jpg
Then this is your homework, with the output above, it will be easy for you to get the file type and average size
source
share