in reply to UNIX command - remove 0 byte file

This is a perl forum so I'll answer with some perl code...
foreach(glob('*.*')) { unlink if -f and !-s _; }
You can change the glob pattern to taste; you may even include a relative or absolute path.

Replies are listed 'Best First'.
Re^2: UNIX command - remove 0 byte file
by rinceWind (Monsignor) on Sep 23, 2005 at 09:35 UTC

    Methinks you have an operator precedence bug here. On second thoughts, what you have is pseudocode (unless you intended it to be a perl 6 style junction :). Should be:

    foreach(glob('*.*')) { unlink if (-f $_) && !-s _; }

    --

    Oh Lord, won’t you burn me a Knoppix CD ?
    My friends all rate Windows, I must disagree.
    Your powers of persuasion will set them all free,
    So oh Lord, won’t you burn me a Knoppix CD ?
    (Missquoting Janis Joplin)