DirSize is a simple directory reporting tool. It recursively scans the provided (or current) directory, and reports the number of files and director sizes of each sub-directory as well as the files in the directory.
You can sort by Directory name, Files, and Size, although Size is the default.
One of the interesting things about DirSize is it shows a visual representation of the file sizes of counts. I call this a SizeMap or FilesMap and it's the area to the right of the output. If you sort by size (default or -ss) or directories (-sd) is will show the SizeMap. If sorted by file counts (-sf) the map will change to show a visual representation of the number of files per subdirectory.
Snap applications run in a container and by default do not have rights to see files. In order to use DirSize, it needs to be able see file names and sized. The interface
system-backup gives it that right. Therefore, to use the system, you need to allow it by executing:
sudo snap connect dirsize:system-backup
If you change your mind, you can remove this permission by executing:
sudo snap disconnect dirsize:system-backup
java -jar dirsize.jar [-D] [-x <filename>] [-ss|-sf|-sd] [-r] [-c width] [-v] [-h|?] [Directory]
-D Run program in debug mode. This will display quite a bit of information on the program as it's running. I usually use this as I debug the program, but if you wish to get a bit more insight into what's going on, go for it.
-e Suppress the error display. Will not show directories dirsize couldn't read
-ss Sort output by the directory sizes. This is the default
-sf Sort output by the number of files
-sd Sort output by directory name
-r Reverse the sorting display
-x FileName Export the results as a CSV to the file provided
-c width On Windows, the current terminal width is set by default. On Linux, it is set to 100 while I look for a way to determine this automatically. You can, however, change this to whatever you'd like. Useful if you have a very wide console display. The minimum terminal display width is 60, but it's looks much better in the 100 character range.
-v Simply display the program version and exit
-h | -? Display the program help
java -jar dirsize.jar
Display a size sorted report from the current directory
java -jar dirsize.jar -sd C:\Apps
Display a directoyr name sorted report from the C:\Apps directory
java -jar dirsize.jar -c 80 -sf /home/jimbob
Display a file number sorted report from the jimbob's home dir using 100 columns
java -jar dirsize.jar -x $HOME/usr-output.csv /usr
Output the directory report of
/usr into a CSV file in my home directory
I'm making this freely available in the hope that others may find this useful. Please let me know if you have any issues, thoughts or suggestions for enhancements by mailing firstname.lastname@example.org.
The MIT License
Copyright (C) 2011-2020 by Michael Fross
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.