Skip to content

Instantly share code, notes, and snippets.

@duanemoody
Created September 12, 2017 22:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save duanemoody/658fcbb925d75c73abd877c9e6f396d2 to your computer and use it in GitHub Desktop.
Save duanemoody/658fcbb925d75c73abd877c9e6f396d2 to your computer and use it in GitHub Desktop.
correct protocol for Automator loop recursing through subfolders
# use Pass input: "to stdin", NOT "as arguments"
while read f ## NOT "for f in $@"
do
# file processing code goes here
done
# Explanation: Apple doesn't document this, but "Pass input: as arguments" has a hard limit of 999 files/folders above which Automator
# throws a "Run Shell Script" error; stdin does not have this limit but alters the way the passed array is referenced.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment