Walks a directory tree, identifies every file by 4-byte magic,
and renames each one to use the correct .w* extension.
Counterpart to single-file --rename-by-magic for the case
where a whole asset bundle came in with mangled extensions
(extracted from a tarball that lost suffixes, downloaded with
CDN-rewritten names, dumped from a database BLOB column).
Same safety semantics as the single-file flag: conflicts are
skipped without --force, --dry-run prints the planned moves
without touching the filesystem. Reports per-file PASS/FAIL/
CONFLICT and a final summary (renamed / skipped-conflict /
already-correct / unrecognized counts). Exits 1 if any
rename failed (e.g. permission errors) so it can be wired
into CI as a gate.
Reads the 4-byte magic of a file, looks it up in the shared
format table, and renames the file to use the correct .w*
extension. Useful when files have lost their extensions
(downloaded as 'data.bin', extracted from a tarball with
mangled metadata, or copied via a tool that strips suffixes).
Safe by default — refuses to overwrite an existing target;
pass --force to allow overwrite. --dry-run prints the planned
move without touching the filesystem. Files that already have
the correct extension are a no-op. Unrecognized magic exits
1 with the bytes printed for diagnostic context.
Reuses cli_format_table.cpp so any future format addition is
picked up automatically.