Normally to remove files with spaces in their filename you would have to run:
$ rm "file name"
but if I want to remove multiple files, e.g.:
$ find . -name "*.txt" | xargs rm
This will not delete files with spaces in them.
command linefindrmxargs
Normally to remove files with spaces in their filename you would have to run:
$ rm "file name"
but if I want to remove multiple files, e.g.:
$ find . -name "*.txt" | xargs rm
This will not delete files with spaces in them.
Best Answer
You can tell
find
andxargs
to both use null terminatorsor (simpler) use the built-in
-delete
action offind
or (thanks @kos)
either of which should respect the system's
ARG_MAX
limit without the need forxargs
.