Hi,

I'd like to present my idea as a feature request for 'du' command. I've been asked several times to count certain file types within a given structure and present the data per each directory and in total (total size per each directory by counting given file types only). E.g. how many LibreOffice documents there are in /home directory, or how many archives are larger than 10MB, or how many video files etc. - and all lists should be sorted by size per each directory and in total.

Later on, I've noticed I am in constant need as well for analyzing my own file structure similarly, e.g. to list all images by size in order to check if there's any content that needs to be optimized. Find command has a power for some of those tasks, but mostly it seems like a perfect fit for "du --include", since "du --exclude" already exists.

E.g. currently, du can tell me a disk usage for all types of content inside of each directory, but I can not filter out such reports only for certain content types that I need to monitor.

I was looking for a tool to quickly achieve this, but surprisingly, there's nothing out there I could find that would suit those demands nicely.

So, I created my own script. It's called wii: https://github.com/madjoe/wii

It could resolve every single task I described from above and it serves me quite well almost on a daily basis now:

Examples:
# lists all image files recursively with individual stats per each subdirectory
wii -i
# lists all archives etc.
wii -r

# lists all custom file types
wii -x "php css js"

# integration of arguments that should be passed to find command
$ wii -c "-type f -mtime -7 -size +2M -name '*log*'"


A few use-cases:

  1. $ wii -vd
  1. $ wii -G0 -ri
  1. $ wii -x "pdf"
  1. $ wii -G0 -i
  1. $ wii -c "-type f -size +30M -mtime -7"

Please let me know what you think.

Thanks in advance!

Cheers,
Jasmin Zainul