Skip to content

Batch Processing Local Files

Batch operations mean one mistake affects hundreds of files. The only acceptable flow:

Scan (read-only) → report → you approve → batch → verify

Never skip the scan or the approval.

Have it investigate without changing anything.

Scan ~/Downloads and report:

  1. Total file count and disk usage
  2. Breakdown by type (images/docs/video/other)
  3. Files over 100MB
  4. Likely duplicates (same name or identical size)
  5. How many files are older than one year

Report only. Do not move, rename, or delete anything.

That last sentence is mandatory. Without it, it will probably “helpfully” start tidying.

  • Are the categories right?
  • Anything in there that shouldn’t be touched?
  • Do the numbers match expectations? (Expected 500, got 5,000 → wrong path)

This is your cheapest intervention point. A one-line correction now beats a rollback later.

Ten files maximum per batch. Verify, then continue.

Process the first 10 files per the plan. Report what you did; wait for my go-ahead before continuing.

Batching caps the damage if the strategy turns out to be wrong.

❌ rm -rf # unrecoverable
✅ move to Trash / gio trash / trash-put

Deletions must go through the trash. If none is available, don’t delete — move to a backup directory and clean it up manually later.

终端窗口
cp -r ~/Downloads ~/Downloads_backup_$(date +%Y%m%d)

Confirm the backup succeeded, then begin. Disk space for peace of mind is always a good trade.

Sorting a downloads folder

Sort ~/Downloads into subfolders by type: images → Images, docs → Documents, archives → Archives, installers → Installers. Only handle files modified in the last 30 days; leave anything older alone. Ten per batch, report after each.

Batch renaming

Rename everything in ~/Photos/trip to YYYY-MM-DD_sequence.jpg based on capture date. Show me the rename table first. Wait for approval before executing.

Format conversion

Convert all .doc files in ./docs to .docx, verify each converted file opens, list any failures, and don’t delete the originals.

  • Recursive operations targeting Desktop, Downloads, Documents, or Home
  • rm -rf, del /S /Q, wildcard deletes
  • Vague requests with huge blast radius (“clean up useless files”)
  • Anything touching system directories (/System, AppData, Library)

Vague request → clarify first, then still only scan. “Clean up my computer” needs the target directory, file types, and criteria before a single file moves.

Spreadsheet Analysis and Visualization.