'rm' Can not delete files

perryh at pluto.rain.com perryh at pluto.rain.com
Sat Feb 11 08:41:07 UTC 2012


Matthew Seaman <freebsd-questions at infracaninophile.co.uk> wrote:

> >>> ls -1 | xargs rm
>
> >> but be aware that that wont work for filenames with spaces.
>
> True.  Can't do that using ls to generate the list of filenames as
> there is no option to generate a null-separated list amongst ls's
> multitudinous collection.

It can, however, be done indirectly :)

$ ls -1 | tr '\012' '\000' | xargs -0 rm


More information about the freebsd-questions mailing list