Linux delete file with size 0

Franz Kafka picture Franz Kafka · Mar 29, 2011 · Viewed 180k times · Source

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

Something like this?

Answer

James.Xu picture James.Xu · Mar 29, 2011

you would want to use find:

 find . -size 0 -delete