# Skill Test

> Recursively extracts .zip, .tar.gz, and .gz files into their own folders, renames conflicts with a _1 suffix, and removes the original archives. Supports macOS, Linux, and Windows. Use this when asked to unzip, extract, or decompress archive files.

- Skill: `aaron-grenier/skill-test` (Agent Skill, multi-file: 4 files)
- Install (CLI): `npx skillmds@latest add aaron-grenier/skill-test`
- Raw SKILL.md: https://api.skillmd.com/api/skills/aaron-grenier/skill-test/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: aaron-grenier (https://skillmd.com/u/aaron-grenier)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/aaron-grenier/skill-test

---


## Unzip Files Without Overwriting

### Step 1 — Ask for the target directory

Before running anything, ask the user:

> "Which directory should I extract archives from?"

Accept absolute or relative paths. Expand `~` to the full home directory path if provided.

### Step 2 — Detect the OS and run the correct script

**macOS / Linux** — run the bash script directly:
```bash
bash /path/to/skill-test/unzip-files.sh "/the/target/directory"
```

**Windows** — run the CMD wrapper (do NOT use pwsh or powershell directly):
```cmd
C:\path\to\skill-test\run.cmd "C:\the\target\directory"
```

> IMPORTANT: On Windows always use `run.cmd`. Never invoke `pwsh` or `powershell` directly.
> `run.cmd` calls `powershell.exe` (Windows PowerShell 5.1) automatically.

### Step 3 — Report results

Summarize what was extracted, renamed, and removed.

---

## How the scripts work

- Accept a target directory as argument (defaults to `.` / current directory if omitted)
- Validate the directory exists and resolve it to an absolute path
- Search **recursively** through the directory and all subdirectories
- `.zip` / `.tar.gz` / `.tgz`: extracted into a new subfolder named after the archive
- `.gz` (single file): decompressed in-place (`name.gz` → `name`)
- If the output target already exists, the archive is **renamed** with `_1`, `_2`, etc. — nothing is overwritten
- Original archive files are **deleted** after successful extraction

## Platform notes

| Feature | macOS/Linux (`unzip-files.sh`) | Windows (`run.cmd` → `unzip-files.ps1`) |
|---|---|---|
| `.zip` | `unzip` | `System.IO.Compression.ZipFile` |
| `.tar.gz` / `.tgz` | `tar -xzf` | `tar -xzf` (Windows Server 2019+) |
| `.gz` single file | `gunzip -c` | `System.IO.Compression.GZipStream` |

