Linux删除大小为0的文件 [英] Linux delete file with size 0
本文介绍了Linux删除大小为0的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果大小为0,如何在Linux中删除某个文件.我想在crontab中执行此文件,而无需任何额外的脚本.
How do I delete a certain file in linux if its size is 0. I want to execute this in an crontab without any extra script.
l filename.file | grep 5th-tab | not eq 0 | rm
像这样吗?
推荐答案
这将删除目录(及以下)中大小为零的所有文件.
This will delete all the files in a directory (and below) that are size zero.
find /tmp -size 0 -print -delete
如果您只想要特定的文件;
If you just want a particular file;
if [ ! -s /tmp/foo ] ; then
rm /tmp/foo
fi
这篇关于Linux删除大小为0的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文