Hacker News new | ask | show | jobs
by sgarland 11 days ago
THANK YOU. I kept nodding along to all of the xargs comments, thinking “sure, but what about the even easier solution?”
1 comments

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 {} \;