[英]how to check the directory size using find command in bash script
我需要找到大于特定值的目录大小,我为此编写了一个脚本。 但是 find 命令不接受 -size 部分。 谁可以帮我这个事
echo -e "This script will generate report for directories which consumes more size than the given value"
read -p " Enter the file system or directory full path: " path
read -p " This script will check the directories which is greater than the given size Please Enter the directory size in GB: " size
find $path -type d -size +$sizeG -exec ls -ld {} \;
错误
find: invalid -size type `+'
为了消除bash脚本中的坏替换错误。 用双配额包装可变大小。
echo -e "This script will generate report for directories which consumes more size than the given value"
read -p " Enter the file system or directory full path: " path
read -p " This script will check the directories which is greater than the given size Please Enter the directory size in GB: " size
echo "+${size}G";
find $path -type d -size "+${size}G" -exec ls -ld {} \;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.