Last active
November 6, 2017 19:39
-
-
Save hjhart/432689a75b358d6c26feb276843c4f72 to your computer and use it in GitHub Desktop.
Revisions
-
hjhart revised this gist
Nov 4, 2017 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ # function happily borrowed from https://unix.stackexchange.com/a/259254 bytesToHuman() { b=${1:-0}; d=''; s=0; S=(Bytes {K,M,G,T,E,P,Y,Z}iB) while ((b > 1024)); do -
hjhart revised this gist
Nov 4, 2017 . 3 changed files with 10 additions and 30 deletions.There are no files selected for viewing
File renamed without changes.This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ .joyent/ 41693 40.71 KiB backup/ 62206189 59.32 MiB backups/ 4732683606342 4.30 TiB cores/ 612648223 584.26 MiB demo/ 22077652 21.05 MiB images/ 298759686 284.91 MiB postgres/ 33733185216 31.41 GiB sitemaps/ 6346928762 5.91 GiB staging/ 5547741 5.29 MiB tmp/ 163482942 155.90 MiB This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,30 +0,0 @@ -
hjhart created this gist
Nov 4, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ bytesToHuman() { b=${1:-0}; d=''; s=0; S=(Bytes {K,M,G,T,E,P,Y,Z}iB) while ((b > 1024)); do d="$(printf ".%02d" $((b % 1024 * 100 / 1024)))" b=$((b / 1024)) let s++ done echo "$b$d ${S[$s]}" } mkdir manta_contents for dir in $(mls | grep -v logs) do echo $dir mkdir -p manta_contents/$dir mls -l $dir >> manta_contents/$(echo $dir)/files for subdir in $(mfind -t d /wanelo/stor/$dir) do mls -l $subdir >> manta_contents/$(echo $dir)/files done done for dir in $(mls | grep -v logs) do bytes=$(cat manta_contents/$dir/files | awk '{ print $4 }' | paste -sd+ - | bc) echo $dir $bytes $(bytesToHuman $bytes) done done This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ bytesToHuman() { b=${1:-0}; d=''; s=0; S=(Bytes {K,M,G,T,E,P,Y,Z}iB) while ((b > 1024)); do d="$(printf ".%02d" $((b % 1024 * 100 / 1024)))" b=$((b / 1024)) let s++ done echo "$b$d ${S[$s]}" } mkdir manta_contents for dir in $(mls) do echo $dir mkdir -p manta_contents/$dir mls -l $dir >> manta_contents/$(echo $dir)/files for subdir in $(mfind -t d /wanelo/stor/$dir) do mls -l $subdir >> manta_contents/$(echo $dir)/files done done for dir in $(mls) do bytes=$(cat manta_contents/$dir/files | awk '{ print $4 }' | paste -sd+ - | bc) echo $dir $bytes $(bytesToHuman $bytes) done done