3 ms·
and `find` has practically re-implemented half the rest of the toolchain. last week i discovered the `-delete` flag. For years, i had been doing `find <stuff>
by hprotagonist 9y ago
and `find` has practically re-implemented half the rest of the toolchain.
last week i discovered the `-delete` flag. For years, i had been doing `find <stuff> | xargs -rm` instead.
- jff 9y agoI don't even bother using 'find' to actually find files. 'du -a <path> | grep <name>' works easily enough and I don't have to remember find's weird syntax.
- sametmax 9y agoI use the ffind program instead. It's just so much easier with saner defaultq.
- eridius 9y agoA better alternative to xargs is `find <stuff> -exec rm {} +` (though of course -delete is simpler).
- barrkel 9y agoI'm not sure there's much upside in using -delete, -exec etc. from find since they're redundant and can be replaced by composition; half the time, I want to stick a grep -v in there between the found paths and the execution, so xargs is usually handier than not. (I have a tool called print0 which converts line terminators to nulls, so I can use xargs -0 along with grep etc. without needing to use -print0.)
- woliveirajr 9y agoBut there are cases where `-delete` or `-exec` aren't enough, and xargs allows better handling.
- flukus 9y agoFor that matter, why do we need xargs and not just `find <stuff? | rm`?