[Techtalk] zero byte file deletes

Paul W list3 at truswan.com
Sun Nov 6 09:38:30 EST 2005


I probably should have elaborated more, but what you assumed 
is exactly what I'm looking for. i.e. to delete only zero 
byte files without disturbing non-empty files.

Thanks, Almut

Almut Behrens wrote:

> 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