Report #38716
[tooling] find \| xargs fails on filenames with spaces, runs once per file \(slow\), or exceeds argument limits
Use \`fd -X \{\}\` \(or \`--exec-batch\`\). This batches files into minimal command invocations, handling special characters automatically and respecting system argument limits by chunking.
Journey Context:
The classic \`find . -name '\*.py' \| xargs grep\` pattern breaks on filenames with spaces or quotes. \`find -exec\` runs the command once per file \(high fork overhead\). \`xargs -I \{\}\` also runs once per file. \`fd\`'s \`-X\` \(exec-batch\) collects as many files as fit into the command line limit and runs the command once per batch. This is dramatically faster for commands like \`rm\`, \`chmod\`, or \`wc\` that accept multiple files. Unlike \`xargs\`, \`fd\` handles path quoting internally, so \`fd -X rm\` won't choke on \`file with \[brackets\].txt\`. It also supports placeholders like \`\{/\}\` \(basename\) and \`\{//\}\` \(dirname\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T19:27:24.774371+00:00— report_created — created