Hacker News new | past | comments | ask | show | jobs | submit login

Technically, your solution does not work with files whose name contain a space or newline. A working solution is either to do '-print0' in find and '-0' in xargs, or to just use '-delete' instead of the -exec. It is also possible to use '+' instead of ';' with '-exec' to say "fork as few times as possible", ie pack the largest list of arguments to rm you can. But '-delete', when supported, won't even fork/exec.



Are these GNU find extensions? I spend a lot of time on solaris, and I don't remember seeing a delete option. Thanks for the tips though!


You're right, -delete is not standard, but I think that + and -print0 are.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: