2017-04-05 78 views

回答

0

递归搜索在当前目录及以下空文件:

find . -empty -type f 
0

递归列出指定目录空文件及以下,报告中的总

findempty

#!/bin/bash 
echo :Number of empty files: `find $1 -empty -type f | tee /dev/tty | wc -l` 

例用法

findempty /tmp 

示例输出

/tmp/source/fb/b 
/tmp/source/fb/a 
/tmp/source/fb/c 
/tmp/source/fa/b 
/tmp/source/fa/a 
/tmp/source/fa/c 
/tmp/source/fc/b 
/tmp/source/fc/a 
/tmp/source/fc/c 
/tmp/dest/source/fb/b 
/tmp/dest/source/fa/b 
/tmp/dest/source/fc/b 
:Number of empty files: 12