“Process all reports” leaves the shell, directory depth and filename rules undecided. Those choices change which files a script touches. Make them part of the request instead of discovering them after a generated command has changed your working folder.
Start with literal arguments
This original rehearsal prints three supplied arguments. It reads no files and changes nothing:
#!/usr/bin/env bash
for file in "$@"; do
printf '<%s>\n' "$file"
done
Save it as list-args.sh, then run it from Bash:
bash list-args.sh 'North report.csv' 'literal*.csv' '-draft.csv'
The expected output is three lines:
<North report.csv>
<literal*.csv>
<-draft.csv>
The quotes around each invocation argument keep the space together and prevent the asterisk from expanding at that point. Inside the loop, quoted "$@" preserves separate arguments. Quoted "$file" passes each value as one argument to printf. The fixed printf format prevents a filename from becoming a format string.
The GNU Bash manual distributed by Debian, checked October 24, 2026, explains quoting and positional parameters. This is Bash syntax, not a PowerShell script. A leading hyphen is harmless to this particular printf call because it is a value after the format; other commands require their own documented option handling.
Supply a complete file-selection request
Use this prompt when adapting the idea to actual files:
Draft a Bash script; do not run commands or modify files.
Environment and Bash version: [ENTER]
Permitted working directory: [ENTER]
File-selection rule: [EXACT EXTENSION, DEPTH, HIDDEN-FILE POLICY]
Symbolic-link policy: [ENTER]
Intended eventual transformation: [DESCRIBE]
First return a listing-only version and explain each expansion.
Keep filenames as distinct values, including spaces, literal wildcard
characters and leading hyphens. Do not parse ls output. State whether
newlines in filenames are supported and how the listing represents them.
Show what happens for no matches and an inaccessible directory.
Do not add deletion, overwrite, recursive traversal, package installation
or a modifying command to this first version. List unresolved choices.
OpenAI's prompting guidance supports naming the context and boundaries. The quoted argument exercise tests one property; it does not prove that a generated directory traversal selects the right files.
Rehearse selection separately from changes
Create a disposable directory with representative names and known subdirectories. Compare the generated listing with the exact expected selection. Also test an empty directory. If the script displays one record per line, a filename containing a newline can make that output ambiguous; either use an unambiguous representation or explicitly exclude that case from the supported contract.
Only after selection is correct should you review the proposed transformation, destination collisions and failure handling. The workflow recovery guide addresses a different problem, remote writes with uncertain outcomes. For local files, keep a backup and review the real command's behavior before allowing changes. Preserve the accepted file-selection rules with the script so a later edit cannot quietly widen its scope.