删除指定日期之前的文件,
- 首先,创建一个基准时间文件
touch -t 202301010000 time_file
, - 然后查看日期是否正确
ll --time-style=long-iso time_file
, - 最后执行删除命令
find . ! -newer time_file | xargs rm
。
如下所示:
touch -t 202301010000 time_file
ll --time-style=long-iso time_file
find . ! -newer time_file | xargs rm
删除文件大小为0的文件
find . -name "*" -type f -size 0c | xargs -n 1 rm -f