Earlier quoted context omitted.
find ./ -name '*.log' | xargs rm Only do that if you know exactly what '*.log' will expand to (i.e. don't use it in scripts and avoid using it on the command line). This is because the delimiter for xargs is a newline character, but filenames can have a newline character in them. This can lead to unexpected results. Almost everywhere I see xargs used, find ...-exec {} ; will work as well and find ...-exec {} + may wo…
find ./ -name '*.log' -print0 | xargs -0 rm Fixes that issue and xargs is far more efficient, it doesn't launch a new process for each line like exec does, but far more importantly, xargs is generalizable to all commands so you only have to learn it once; exec is just an ugly hack on find, you can't generalize it across all commands; xargs is much more unixy.
Exec doesn't either if you use "+" as a terminator:
find . $(options) -exec command {} \;
executes one command per match, find . $(options) -exec command {} +
executes a single command with all matches> exec is just an ugly hack on find
Obvious and complete nonsense, -exec is both an important predicate of find and a useful and efficient tool.
-print0/xargs -0, now that is a hack.