Question
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.
How-To
This will delete all the files in a directory (and below) that are size zero:
If you just want a particular file;
- // -s: Detect file exist or not and should be not empty!
- if [ ! -s /tmp/foo ] ; then
- rm /tmp/foo
- fi
* How to delete many 0 byte files in linux?
* VBird - Ch12 - 學習 Shell Scripts
沒有留言:
張貼留言