← ClaudeAtlas

symlink-vs-realfile-classify-before-deleting-fanout-dupslisted

Use during a memory/skill/config dedup on a symlink-fanned tree (like claude-config, where install.sh symlinks universal cards into per-project dirs and ~/.claude) — before deleting any "duplicate", run a `test -L` classification loop so you delete only genuine real-file dups (often a sister session's copy) and KEEP the session's own install.sh fan-out symlinks. Guards against a near-miss deleting your own fan-out.
hjr15/claude-kit · ★ 0 · Data & Documents · score 76
Install: claude install-skill hjr15/claude-kit
# Classify Symlink vs Real File Before Deleting Fan-Out Duplicates ## Overview In a symlink-fanned config tree, one logical file legitimately appears at many paths. In `claude-config`, `scripts/install.sh` fans universal memory cards out by **symlink** — one real file under `memory/_universal/`, symlinks into every project's memory dir and into `~/.claude`. During a dedup sweep, those symlinks look exactly like "duplicates" and a naive `find … -delete` or "remove the copy" will destroy your own fan-out. The rule: **never delete a path in a fan-out tree without classifying it first.** A symlink pointing back at the canonical source is *intended fan-out* — keep it. A **real file** with the same content as the canonical one is a genuine dup (often a sister session's stray copy or a pre-symlink leftover) — that's what you delete. ## When to Use - Deduplicating memory cards / skills / any config across a tree that `install.sh` (or equivalent) symlink-fans-out. - You've found N paths with the same name/content and are about to remove the "extras". - Any symlink-fanned repo where one source is projected into many locations. ## The Classification Loop Test each candidate path before touching it: ```bash for p in <candidate-paths>; do if [ -L "$p" ]; then printf 'SYMLINK (keep — fan-out): %s -> %s\n' "$p" "$(readlink "$p")" else printf 'REAL FILE (candidate to delete): %s\n' "$p" fi done ``` - **`-L` true → symlink → KEEP.** It's install.sh's fan-out. Confir