What's the easiest/best way to find and remove empty (zero-byte) files using only tools native to Mac OS X?
+1
A:
find /path/to/stuff -empty
If that's the list of files you're looking for then make the command:
find /path/to/stuff -empty -exec rm {} \;
Be careful! There won't be any way to undo this!
dwc
2009-02-13 01:49:48
Better to use + than ; if you have a current find -- that way it acts the way xargs would if it were in the pipeline.
Charles Duffy
2009-02-13 01:50:31
So, in English, "find all empty files in the current directory and delete them without prompting the user"?
endolith
2010-03-05 13:45:44
@endolith - the command already given does recurse; you'd need to use an argument such as `-maxdepth 1` to prevent it from doing so.
Charles Duffy
2010-03-05 14:29:20
+1
A:
Use:
find . -type f -size 0b -exec rm {} ';'
with all the other possible variations to limit what gets deleted.
paxdiablo
2009-02-13 01:50:51