[英]How to get total size of all files recursively under directory
I am using this command to get the files less than 17MB: 我正在使用此命令来获取小于17MB的文件:
hadoop fsck /admin_test -files |
gawk '{if ($2 ~ /^[0-9]+$/ && $2 <= 17825792) print $1,$2;}'
How can I get the total size of all files less than 17MB? 如何获得小于17MB的所有文件的总大小?
gawk '
$2 ~ /^[0-9]+$/ && $2 <= 17825792 {sum += $2; print $1, $2}
END {print "sum=", 0+sum}
'
what about using du
with the --threshold=SIZE
arg: 如何将
du
与--threshold=SIZE
参数一起使用:
-t, --threshold=SIZE
exclude entries smaller than SIZE if positive, or entries greater than SIZE if negative
something like this: 像这样的东西:
du -sk --threshold=-17825792 /admin_test
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.