我正在尝试编写一个脚本,该脚本将计算目录大小,如果大小小于10GB,然后大于2GB,请执行一些操作。我在哪里需要提及我的文件夹名称?
# 10GB
SIZE="1074747474"
# check the current size
CHECK="`du /data/sflow_log/`"
if [ "$CHECK" -gt "$SIZE" ]; then
echo "DONE"
fi
你可以做:
du -h your_directory
这将为您提供目标目录的大小。
如果要简短的输出,du -hcs your_directory
很好。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句