Skip to content

Instantly share code, notes, and snippets.

@Integralist
Created June 5, 2023 12:29
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 Integralist/ceede527325efbfd320944677b30197b to your computer and use it in GitHub Desktop.
Save Integralist/ceede527325efbfd320944677b30197b to your computer and use it in GitHub Desktop.
[find files asynchronously] #xargs #async #find
#!/bin/bash
replacement_patterns() {
echo "Processing file: $1"
}
replacement_patterns "$@"
# on macOS we have to use a separate shell process with a separate script file for async processing to work...
find "/Users/integralist/Code/path/to/directory" -type f -print0 | xargs -0 -P "$(nproc)" -n 1 bash -c './async.sh "$@"' _
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment