#!/bin/sh
if [ $# -ne 2 ] ; then
echo "Input: $(basename $0) path filename"
exit -1
fi
find $1 -name "$2" -exec du -h {} \; | awk '{if($1~"G") {printf("%s\n",$1);gsub("G","");$1=$1*1000*1000} else if($1~"M") {printf("%s\n",$1);gsub("M","");$1=$1*1000} else if($1~"K") {printf("%s\n",$1); gsub("K","")};sum+=$1} END{printf("\nsum=%dM\n",sum/1000)}'
exit 0
阅读(1110) | 评论(0) | 转发(0) |