| name | nested-zip |
| version | 1.0.0 |
| description | Zip each subfolder of a source folder individually, move the original
unzipped subfolders into a sibling "<name>-raw" folder, then zip the whole
source folder into "<name>.zip". Use whenever the user wants to "nested-zip"
a folder, archive a folder of folders, bundle subfolders into per-folder zips
while keeping a raw backup aside, or asks for the /nested-zip command.
Invoked as /nested-zip <source folder>.
|
| allowed-tools | ["Bash","AskUserQuestion","TodoWrite"] |
Nested Zip
Turn a folder full of subfolders into a tidy archive: every subfolder becomes
its own .zip, the original (unzipped) subfolders get moved aside into a
<name>-raw sibling folder as a backup, and finally the whole source folder
(now holding only the zips) is itself zipped.
This is handy for things like exported document sets — you keep a lightweight
archive of zips, a raw backup of the originals, and a single shareable
<name>.zip of everything.
Input
The user supplies one source folder: /nested-zip <source folder>. If they
don't, ask which folder to process. The source folder is expected to contain
one or more subfolders (hidden folders like .git/.claude are ignored).
Result layout
For a source folder /path/to/foo containing subfolders A, B, C:
/path/to/foo/ # now contains ONLY A.zip, B.zip, C.zip
/path/to/foo-raw/ # the original unzipped A, B, C
/path/to/foo.zip # zip of foo (the folder of zips)
- Each per-subfolder zip stores the subfolder as its top-level entry
(e.g.
A/...), produced by zipping from inside the source folder.
- The final
foo.zip stores foo/ at top level, containing the per-subfolder
zips. Originals are already moved out, so it only contains the zips.
- macOS
.DS_Store files and any .claude/ config are excluded from
foo.zip to keep it clean.
Workflow
Use the bundled script — it does all three steps atomically and has the
guard rails (absolute-path resolution, refusing to clobber an existing
-raw folder, skipping hidden dirs):
bash scripts/nested-zip.sh "<source folder>"
The script:
- Zips each immediate subfolder in place (
<subfolder>.zip).
- Creates the sibling
<name>-raw/ folder and moves the original
subfolders into it.
- Zips the whole source folder into
<name>.zip one directory up.
Safety
- The script refuses to run if
<name>-raw already exists, so it never
overwrites a previous backup. If the user wants to re-run, confirm whether
to remove or rename the existing -raw folder first.
- It errors out if the source has no subfolders (nothing to zip).
- Originals are moved, not deleted — they live in
<name>-raw/ until the
user removes them.
After running
Report the three outputs and their sizes so the user can verify, e.g.:
ls -la "<source folder>" "<source folder>-raw"
ls -la "$(dirname "<source folder>")/$(basename "<source folder>").zip"
Verifying / spot-checking
To confirm a per-subfolder zip and the final archive look right:
unzip -l "<source folder>/<some subfolder>.zip" | head
unzip -l "$(dirname "<source folder>")/$(basename "<source folder>").zip" | head