Hacker News new | ask | show | jobs
by AdieuToLogic 8 days ago
To support your recommendation and redress the strawman the article postulates, the post's author could have replaced:

  find . -name '*.log' | xargs rm
With:

  find . -name '*.log' -print0 | xargs -0 rm
1 comments

This one doesn't need xargs.

  find . -name '*.log' -delete
THANK YOU. I kept nodding along to all of the xargs comments, thinking “sure, but what about the even easier solution?”
As well as find has an -exec param to perform things one at a time or all with the same command by using a slash semicolon or a plus sign respectively:

  #order files from different levels in a file hierarchy by size:
  find . -type f -maxdepth 1 -exec ls -hlrS {} +

  #output metadata for each file sequentially
  find . -type f -maxdepth 1 -exec file {} \;