delete_file.sh 登录后复制 #!/bin/bash #删除某个目录下大小为 0 的文件 dir="/tmp" find $dir -type f -size 0 -exec rm -rf {} \; 1.2.3.4.5. 验证: 登录后复制 [root@logstash tmp]# ls *.txt 10.txt 1.txt 2.txt 3.txt 4.txt 5.txt 6.txt 7.txt 8.txt 9.txt [root@logstash tmp]# sh /root/delete_file.sh [root@logstash tmp]# ls *.txt ls: cannot access *.txt: No such file or directory [root@logstash tmp]# 1.2.3.4.5.6. 原创作者: ztj1216 转载于: https://blog.51cto.com/ztj1216/11701020