in reply to Re^5: UNIX command - remove 0 byte file
in thread UNIX command - remove 0 byte file
Note the use of \x27 for single quote, lest it ends the argument to perl.find /path/ -size 0 | perl -ple 's/\x27/\x27"\x27"\x27/g; "\x27$_\x27"' | xargs -n ... rm
Of course, if you're going to pipe into perl, there's not much point in calling xargs rm is there? Might as well do the removal from within perl:
Note that both pieces of code given above still fail on filenames containing newlines.find /path/ -size 0 | perl -nle 'unlink or warn "unlink $_: $!\n"'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: UNIX command - remove 0 byte file
by Moron (Curate) on Sep 23, 2005 at 15:05 UTC | |
by Anonymous Monk on Sep 23, 2005 at 15:27 UTC |