Batch file automated a clean-up job, then fouled itself by deleting the wrong directory
- ID
- 17158
- Status
- summarized
- Published
- 24 Aug 2026, 2:31 PM
- Fetched
- 24 Aug 2026, 2:41 PM
- Provider
- The Register
- Category
- technology
- Original URL
- https://www.theregister.com/software/2026/08/24/batch-file-automated-a-clean-up-job-then-fouled-itself-by-deleting-the-wrong-directory/5290873
- Source URL
- https://www.theregister.com/headlines.atom
Summary
- Score
- 3.5
- Created
- 24 Aug 2026, 2:42 PM
- Tags
- Audience
- developersvibe_coders
What happened
A reader's batch script for weekly Exchange Information Store defrag used `DEL *.*` without specifying a directory, and because it ran from System32, it wiped most of that folder and lobotomized a Windows NT 4 server hosting ~600 mailboxes. The server needed a full rebuild and restore over the weekend.
Why it matters
A concrete reminder that automation scripts inherit their working directory and unqualified wildcard deletes are catastrophic; always pin absolute paths and test destructive commands in a sandbox before scheduling them unattended.
Discussion angle
What guardrails (explicit working directory, dry-run mode, least-privilege execution) do you put around cleanup scripts that delete files?