name: file-manager description: >- Manage, organize, sort, rename, dedupe, or archive files on disk. Use when reshaping a directory tree, batch-renaming, deduplicating, sorting media by date or location, mounting or extracting disk images, or cleaning up a folder. Skip for git operations and code edits.
file-manager
Filesystem management and reorganization with the tools on this machine.
Scale safety (read first)
These tools will happily walk a TB-scale tree or millions of files and appear to hang for many minutes. Four rules:
Probe before recursing. Run a depth-1 walk first to learn the shape of the tree:
df -h <dir> # filesystem capacity fd --max-depth 1 -t f . <dir> | wc -l # top-level fanout dust -d 1 -n 10 <dir> # byte distributionDecide the strategy from these numbers. Never run a recursive command on a directory whose size you have not confirmed.
Cap every recursive command with the tool's depth, count, or size flag. Defaults by phase:
- probe =
--max-depth 1 - inspect =
--max-depth 2,-d 2,--level=2 - work = depth 3+ only after a probe shows it is safe
Never run
dust .,fclones group .,eza -lT ., orczkawka_cli image -d .bare on an unknown tree.- probe =
Bound anything still unbounded with the Bash tool's
timeout(default 120000 ms, max 600000 ms) orrun_in_background: truefor jobs that may exceed 10 min. If a bounded run trips its limit, stop and re-plan; do not bump the limit reflexively. See large-fs.md for per-job sizing and the non-Claude-Codetimeout(1)fallback.NUL-delimited pipes at scale. Million-file trees contain filenames with spaces and newlines. Use
fd -0 ... | xargs -0 ...(orfd ... -X cmd, which delimits internally). Newline-delimited pipelines are a correctness bug at this scale.
Per-tool flag tables and segmentation patterns: large-fs.md.
Naming conventions (read second)
Output names and layouts must follow these rules. They override any
tool's built-in defaults; post-process with rnr regex (or fd ... -x mv) when a tool's pattern doesn't fit.
- Charset:
[a-z0-9_-]. Lowercase.-between words,_between logical fields (date/time, subject/version). - Periods only for semantic compound extensions -- ones a tool
dispatches on (
.tar.gz,.d.ts,.schema.json). Version, draft, and locale markers belong inside the stem. - Layout is domain-driven, not type-driven. Group by what the files are about, not their format.
- Dates:
yyyy-MM-dd(2026-04-28); add_HH-mm-ssonly when seconds matter. Wall-clock / civil time, no zone marker -- zone info lives in sidecar metadata.
Rationale, edge cases, normalization recipes: naming.md.
Quick Reference
- Photos / videos with EXIF ->
photo-cli copy. Always try it before scripting EXIF parsing yourself. See photo-cli.md. - Find files / inspect a tree ->
fd(notfind),eza -lT(notls). See inspect.md. - What's eating disk space ->
dust(tree summary). See inspect.md. - Find exact duplicates ->
fclones. - Find similar duplicates (rotated photos, near-duplicate audio) ->
czkawka_cli. See dedupe.md. - Bulk rename ->
rnr regexfor pattern-based renames, orfd ... -x mv {} {.}.<new>for one-offs in a pipeline. See rename.md. - Bulk-rewrite text inside many non-source files (notes, configs,
CSV/TSV, generated data) ->
sd(notsed). For single source files prefer the Edit tool --sdrewrites in place with no undo. See rename.md. - Pull fields from documents ->
jq(JSON -- see inspect.md),yq(YAML). - Tweak EXIF beyond
photo-cli(e.g. shift timestamps, rename single files by tag) ->exiftool. See images.md. - Optimize images ->
jpegoptim(JPEG),oxipng(PNG). Verify withjpeginfo -c/pngcheck. See images.md. - Convert / resize images ->
magick(ImageMagick). See images.md. - Extract zip / rar / 7z / tar / tar.gz ->
7zz. See archives.md. - Mount or extract a disk image (
.img, VHD, VMDK, QCOW2) ->7zzor extraction,apfs-fuse/ntfs-3g/mount.exfat-fusefor FUSE mount. See fuse.md. - Archive a sorted tree ->
tar --zstd. See archives.md. - Safer delete ->
gomiinstead ofrm. See delete.md. - Monitor progress of a long op ->
pv(pipe throughput),progress(peek at running cp/mv/dd/tar),viddy(watch the destination grow),ts(timestamp stderr). See large-fs.md.
Workflow
The pattern for any non-trivial reorganization:
- Probe with bounded walks:
eza -lT --level=2 src/,dust -d 2 src/, orfd --max-depth 2 ... | head. Don't skip this even on small trees -- it's cheap insurance against runningdust .on the wrong directory. Scale safety above explains why the caps are mandatory. - Plan the layout before any move. Domain-driven, not type-driven
(see naming.md). Sketch the target tree,
map source files into it, then reach for
mv. - Dry-run destructive ops.
rnr regexandfclones groupboth default to a preview;fd ... -x mvdoes not, so prefix the action withecho(fd ... -x echo mv ...) and read the printed commands before re-running withoutecho. - Apply with the bounded forms (depth flag,
--max-results, NUL-delimited pipes at scale). - Verify afterwards: post-move tree (
eza -lT --level=2 dst/), file count parity (fd -t f . src/ | wc -lvsfd -t f . dst/ | wc -l), and -- for destructive ops -- confirm the trash holds what you expect before anything is emptied.
For media, try photo-cli copy before writing date / location sorting
yourself.