Answer: Use a Bash for loop over the files, running copilot with -p for each file and piping output to tee to append results to a log. For example: for file in src/api/*.ts; do echo "--- Reviewing $file ---" | tee -a review-results.md copilot -p "Review $file for error handling issues" -s --allow-all-tools | tee -a review-results.md done Status: Confirmed Entry: tool/github-copilot/agents-and-automation/process-multiple-files Revision: 2 Digest: sha256:ad3f684591f2257e (changes whenever the content changes) Timeline: Created: 2026-11-13T12:49:39Z Last changed: 2026-11-19T12:55:41Z (Loop end: — → done) Last verified: 2026-11-20T13:01:56Z Next check: 2026-11-21T13:01:56Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of Loop pattern | for file in src/api/*.ts; do | [1] | 2026-11-20 Copilot command | copilot -p "Review $file for error handling issues" -s --allow-all-tools | [1] | 2026-11-20 Output logging | tee -a review-results.md | [1] | 2026-11-20 Loop end | done | [1] | 2026-11-20 Sources: [1] GitHub. "Running GitHub Copilot CLI programmatically - GitHub Docs". https://docs.github.com/en/copilot/how-tos/copilot-cli/automate-copilot-cli/run-cli-programmatically Role: primary. Accessed: 2026-11-20T13:01:56Z Quote: "for file in src/api/*.ts; do" (Supports: Loop pattern) Quote: "copilot -p "Review $file for error handling issues" -s --allow-all-tools" (Supports: Copilot command) Quote: "tee -a review-results.md" (Supports: Output logging) Quote: "done" (Supports: Loop end) Snapshot SHA-256: 64285b720a1209bcc8a8356ad5bcdd8299d37e9da079d9bd7474ff7b77e131c4 (captured 2026-11-18T12:56:07Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. On this check the text of [1] was unchanged since 2026-11-18T12:56:07Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T13:01:56Z. No independent second source is configured for this entry Last successful check: 2026-11-20T13:01:56Z Last attempt: 2026-11-20T13:01:56Z Notes and limitations: Extracted automatically from a single official source (section "Process multiple files"). Related: https://latestn.com/tool/github-copilot/agents-and-automation/provide-visual-context How do I provide visual context to GitHub Copilot when researching or planning code changes? https://latestn.com/tool/github-copilot/agents-and-automation/query-past-sessions How do I query past GitHub Copilot agent sessions and what are the prerequisites? https://latestn.com/tool/github-copilot/agents-and-automation/readme-specialist-agent-profile What does the README specialist custom agent profile for GitHub Copilot look like? https://latestn.com/tool/github-copilot/agents-and-automation/pre-tool-use-modify-arguments How do I modify tool arguments in the GitHub Copilot pre-tool use hook? https://latestn.com/tool/github-copilot/agents-and-automation/preinstall-tools-dependencies How do I preinstall tools or dependencies in GitHub Copilot's environment? https://latestn.com/tool/github-copilot/agents-and-automation/prepare-to-govern-agents How do I prepare to govern agents in GitHub Copilot for my enterprise? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-19T12:55:41Z | changed | Loop end: — → done | [1] 2026-11-19T12:55:41Z | changed | Output logging: — → tee -a review-results.md | [1] 2026-11-19T12:55:41Z | changed | Copilot command: — → copilot -p "Review $file for error handling issues" -s --allow-all-tools | [1] 2026-11-19T12:55:41Z | changed | Loop pattern: — → for file in src/api/*.ts; do | [1] 2026-11-19T12:55:41Z | changed | output file: review-results.md → — | [1] 2026-11-19T12:55:41Z | changed | copilot invocation: copilot -p "Review $file for error handling issues" -s --allow-all-tools → — | [1] 2026-11-19T12:55:41Z | changed | loop command: for file in src/api/*.ts; do → — | [1] 2026-11-17T13:17:57Z | recovered | Check succeeded again | — 2026-11-16T12:45:30Z | check-failed | Extraction did not pass verification: answer does not contain any extracted value | — 2026-11-13T12:49:39Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/github-copilot/agents-and-automation/process-multiple-files/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/github-copilot/agents-and-automation/process-multiple-files POST: https://latestn.com/dispute/tool/github-copilot/agents-and-automation/process-multiple-files with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/github-copilot/agents-and-automation/process-multiple-files?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I process multiple files with GitHub Copilot CLI in a script? Revision 2, last verified 2026-11-20T13:01:56Z. https://latestn.com/tool/github-copilot/agents-and-automation/process-multiple-files (accessed 2026-11-21T09:54:25Z). @misc{LatestN_tool_github_copilot_agents_and_automation_process_multiple_files_r2, title = {How do I process multiple files with GitHub Copilot CLI in a script?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/github-copilot/agents-and-automation/process-multiple-files}}, note = {Revision 2; digest sha256:ad3f684591f2257e; last verified 2026-11-20T13:01:56Z; accessed 2026-11-21T09:54:25Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/github-copilot/agents-and-automation/process-multiple-files