# README
dirsize
Command tool for summarizing size of directories and files in directories. dirsize is wiritten in golang.
Install
This package is "go-gettable", just:
go get github.com/shenwei356/dirsize
go install github.com/shenwei356/dirsize
Usage
Usage: dirsize [OPTION]... [DIR]...
Summarize size of directories and files in directories.
OPTION:
-a=false: sort by Alphabet.
-r=false: sort by Size.
-s=true: reverse order while sorting.
Example
dirsize -s -r .
Result:
.: 2.40 MB
483.00 B .gitattributes
1.07 KB LICENSE
1.15 KB README.md
1.92 KB .gitignore
2.76 KB main.go
1.02 MB .git
1.37 MB dirsize.exe
Have a Try
You can compile by yourself or just download the executable files immediately.
Attention
The ouput text is encoded in UTF-8. For those who use none-utf8 shell, redirecting to a temporary file is an easy solution.
dirsize -s -r . > tmp.txt
Copyright (c) 2013, Wei Shen ([email protected])
# Functions
Bytes produces a human readable representation of an SI size.
FolderSize gets total size of files in a directory, and stores the sizes of first level directories and files in a key-value list.
IBytes produces a human readable representation of an IEC size.
ParseBytes parses a string representation of bytes into the number of bytes it represents.
# Structs
ByValue sorts by value.
Item records a file and its size.
ReverseByKey reverses the order.
ReverseByValue reverses the order.
# Type aliases
ByKey sorts by key.