Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

du: util for "disk usage" added #438

Merged
merged 1 commit into from
Oct 22, 2015
Merged

du: util for "disk usage" added #438

merged 1 commit into from
Oct 22, 2015

Conversation

odeke-em
Copy link
Owner

This PR addresses #100 by only adding du.

Added a utility analogous to UNIX util "du".
A couple of differences though:

  • drive's du prints breadth first ie level by level.
  • drive's du prints the bytes of every single file, not just
    directories.

Added a utility analogous to UNIX util "du".
A couple of differences though:
+ drive's du prints breadth first ie level by level.
+ drive's du prints the bytes of every single file, not just
directories.
@odeke-em odeke-em merged commit e3881cd into master Oct 22, 2015
@odeke-em odeke-em deleted the du branch October 24, 2015 05:40
@akomakom
Copy link

akomakom commented Dec 25, 2018

@odeke-em is there any documentation on this feature anywhere? This PR says "not just directories", implying that it handles directories, but I've found no equivalent to du -s (directory size total) in this utility:

$ drive du temp
0            /temp/3
0            /temp/2
0            /temp/1

$ drive du -no-prompt -recursive temp
0            /temp/3
0            /temp/2
0            /temp/1
3801088      /temp/3/test2.txt
4456448      /temp/3/test1.txt
4730880      /temp/2/test1.txt
6971392      /temp/2/test2.txt
7077888      /temp/1/test2.txt
6553600      /temp/1/test.txt

$ drive du -no-prompt -recursive -directories temp
0            /temp/3
0            /temp/2
0            /temp/1

Thanks!

Workaround:

Single sum at this level: (like du -s)
drive du -no-prompt -recursive | awk '{s+=$1} END {print s}'

Detailed usage for each sub-item: ( like du -s * but without the total )
drive ls | while read line ; do echo "$(drive du -no-prompt -recursive "${line/\//}" | awk '{s+=$1} END {print s}') $line" ; done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants