GNU bug report logs - #42471
du --include

Previous Next

Package: coreutils;

Reported by: jazz.com <at> gmail.com

Date: Wed, 22 Jul 2020 00:03:02 UTC

Severity: normal

To reply to this bug, email your comments to 42471 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#42471; Package coreutils. (Wed, 22 Jul 2020 00:03:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to jazz.com <at> gmail.com:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Wed, 22 Jul 2020 00:03:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jasmin Zainul <jazz.com <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: du --include
Date: Wed, 22 Jul 2020 00:57:31 +0200
[Message part 1 (text/plain, inline)]
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:

   - You know what you're looking for, but don't have any idea where it
   could be or what's the name of it. All you know is that you're looking
   for a video file somewhere within a certain directory tree, and there
   should also be tons of some PowerPoint documents as well.


   1. $ wii -vd


   - You may assume that your archives and images are eating lots of disk
   space, so you need to check the structure recursively to see the exact
   numbers and make a decision which files to delete, or move to a different
   location.


   1. $ wii -G0 -ri


   - You’d like to check very quickly how many PDF's are stored within
   multiple directories and how much of total disk space only those files
   occupy.


   1. $ wii -x "pdf"


   - Before you upload a new version of your website, you may want to check
   if some of the images are too heavy and need to be optimized.


   1. $ wii -G0 -i


   - Recently you updated your system and now you’d like to list all the
   files max. a week old that are larger than e.g. 30MB each. Also, you’d like
   to sum the results per each directory and see a total summary.


   1. $ wii -c "-type f -size +30M -mtime -7"


   - In all of the examples from above, there would be “total” visible at
   the bottom of each list, where you could check how many of those files
   share the same filename, which may indicate unwanted duplicates.


Please let me know what you think.

Thanks in advance!

Cheers,
Jasmin Zainul
[Message part 2 (text/html, inline)]

This bug report was last modified 4 years and 107 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.