编写shell脚本批量查看hdfs目录的文件夹个数,文件个数,文件总大小

转载来自bug:

(1)脚本如下:cat count.sh

files=`cat files`
for file in ${files}; do
	hdfs dfs -count -q ${file} | awk '{for(i=5;i<=NF;i++) printf $i",";printf "\n"}' >> conut.log
done

(2)当前目录下创建files文件,并粘贴要统计的文件路径

(3)后台运行脚本:

nohup sh count.sh & 

猜你喜欢

转载自blog.csdn.net/qq_35440040/article/details/86481136