Skip to content

Write a robust backup rotation script (dry-run, spaces, exit codes, safe deletion)

Exact prompt

# Task: write a robust backup-rotation shell script Write `rotate.sh` (bash, coreutils + tar/gzip only) implementing: ``` rotate.sh [--keep N] [--dry-run] SRC_DIR DEST_DIR ``` - Creates `DEST_DIR/backup-YYYYMMDD-HHMMSS.tar.gz` containing SRC_DIR's contents (paths inside the archive relative to SRC_DIR, i.e. `./file`), excluding any `*.tmp` files and any directory named `.cache` (at any depth). Use the timestamp from env `BACKUP_NOW` (format `YYYYMMDD-HHMMSS`) if set, else the current UTC time. Creates DEST_DIR if missing. - Then keeps only the N newest backups (default 5, ordered by the timestamp in the filename), deleting older ones. Never delete files in DEST_DIR that don't match `backup-????????-??????.tar.gz`. - `--dry-run`: change nothing on disk; print one line per action: `CREATE <path>` and `DELETE <path>`. - Must handle file/dir names with spaces, newlines are not required. - Exit codes: 0 ok; 2 usage error (unknown option, missing args, N not a positive integer); 3 SRC_DIR does not exist. Errors go to stderr. - `rotate.sh --help` prints usage to stdout and exits 0. Make it executable. No network.

15 scenario checks incl. names with spaces, excluded .cache/*.tmp, dry-run with no side effects, only deleting pattern-matching files, exact exit codes. Original benchmark task written for usecaserank.com (not based on a specific public post). Headless, offline run on a reproducible fixture. Each run's notes say how its cost was measured (estimates are marked).

Success criteria: 1. 15 scenario checks in a private temp dir, all must pass: 2. --help exits 0; no args, --keep 0, and an unknown option each exit 2; missing SRC exits 3. 3. Archive created as backup-<BACKUP_NOW>.tar.gz; it contains './sub dir/my file.txt' and './a/keep.log' and no *.tmp or .cache entries. 4. --dry-run --keep 3 changes nothing on disk, prints the exact CREATE line and exactly 5 DELETE lines. 5. Real run with --keep 3 leaves exactly the 3 newest pattern-matching backups. 6. Non-matching files (notes.txt, 'backup-old copy.tar.gz') are never deleted. 7. Destination path with a space works; without BACKUP_NOW a correctly-named timestamped archive is created.

Best model for this task so far: Claude Haiku 5.5 (effort default (no --effort flag) · thinking on) (success, $0.01, 1m).

Run this on another model

All runs (5)

60% pass rate across 5 eligible runs: 3 pass, 1 partial, 1 fail. Partial and failed runs are listed below with everything else.ⓘ

Runs for this use case
ModelCostTimeStep-insⓘAutonomyOutcomeTrustⓘDateCompare
OGPT-6.1 Soldefault · thinking on$0.041m0Fully autonomouspartialTrust 80%2026-10-22
DDeepSeek V4.1 Flash (Venice)thinking on$0.033m0Fully autonomousfailTrust 80%2026-10-20
AClaude Haiku 5.5default · thinking on$0.011m0Fully autonomouspassTrust 80%2026-10-16
AClaude Opus 5.5default · thinking on$0.271m0Fully autonomouspassTrust 80%2026-10-16
AClaude Sonnet 5.5default · thinking on$0.0930s0Fully autonomouspassTrust 80%2026-10-16

Embed this result

A live badge for this use case. It links back here and updates as new runs are published.

UseCaseRank badge for Write a robust backup rotation script (dry-run, spaces, exit codes, safe deletion)

Get new runs and ranking changes weekly

Which models got better or cheaper on real tasks like this one.