使用 Shell 脚本编写一个程序,在指定目录下查找所有的空文件,并输出它们的文件名。
使用Shell脚本查找空文件
#!/bin/bash
# 指定目录
target_dir="/path/to/directory"
# 查找空文件并输出文件名
echo "空文件列表:"
find $target_dir -type f -empty -exec basename {} \;
#!/bin/bash
# 指定目录
target_dir="/path/to/directory"
# 查找空文件并输出文件名
echo "空文件列表:"
find $target_dir -type f -empty -exec basename {} \;