[Techtalk] zero byte file deletes
Almut Behrens
almut-behrens at gmx.net
Sat Nov 5 22:31:33 EST 2005
On Sat, Nov 05, 2005 at 12:19:15AM -0800, Paul W wrote:
> Google is not being helpful with this. Is there a way to
> delete zero byte files in a directory?
not entirely sure I understand what you need, but if you want to
cleanup all zero byte files with a single command, in a directory with
other non-empty files you want to keep, then the following should do
the trick:
find . -size 0 -exec rm -f {} \;
By default this would recurse into subdirectories, so depending on
whether that's what you desire, you might want to add the option
'maxdepth' to limit it to the current directory:
find . -maxdepth 1 -size 0 -exec rm -f {} \;
Cheers,
Almut
More information about the Techtalk
mailing list