Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Possible Duplicate:
Bash Find Files with zero size and delete files with different extensions

How can I delete files that have a size of 0 in bash?

share|improve this question

marked as duplicate by Nifle, Tom Wijsman, Ƭᴇcʜιᴇ007, Indrek, Renan Aug 4 '12 at 17:35

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

The message should make you think if your question is actually good. Why shouldn't you be able to remove the file? It should work regardless of its size. Can you be more specific please? For example, include a directory listing, the commands you're using and the errors you get. –  slhck Aug 4 '12 at 16:33

1 Answer 1

Remove all zero size files from current directory (non recursive)

find . -maxdepth 1 -empty -delete


find . -maxdepth 1 -size 0c -delete

Remove all zero size files from current path (recursive)

find . -empty -delete


find . -size 0c -delete
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.