# gssize

CLI tool that walks a directory tree, sums file sizes by category (images, audio, video, code, other), and prints aligned tables: a **summary** (totals and share of disk), a **global top-N** file list (by size, skipped when `max-files` is `0`), and **five per-category** lists (same `N` as `max-files`, or **all** files in that category when `max-files` is `0`). Raster and some container formats report **width × height** when headers can be read cheaply.

**Platforms:** Windows 10+, macOS, and Linux (Rust 2024).

**Locales:** Table output follows the system UI language: **Simplified Chinese** labels when the environment indicates `zh-CN` / `zh_CN` (see `src/l10n.rs`); otherwise **English**. `--help`, errors on stderr, and source code stay English.

## Build

```sh
cargo build --release
```

The release profile matches a small static-binary style (`opt-level = "z"`, LTO, strip).

## Usage

```sh
gssize --input <DIR>
gssize -i <DIR> --max-files 20
```

| Flag | Description |
|------|-------------|
| `-i`, `--input` | Root directory to scan (required). |
| `--max-files` | Max rows in the **global** table and in **each** of the five category tables (default `15`). `0` skips the global table only; category tables then list **all** files in that category (still sorted by size). |
| `--follow-symlinks` | Follow symlinks while walking (default: off). |

Paths in tables are **relative to `--input`**. Sizes use **binary** KiB / MiB / GiB (1024). Percentages: **of total** in the summary; per file, **of global total** and **of that file’s category total**.

## Image dimensions

For files classified as images: common raster extensions use `image::image_dimensions`; **DDS** uses a minimal header read; **KTX2** uses the `ktx2` crate. On failure or unsupported GPU-only formats, the dimension column shows `-`.

## License

MIT — see [LICENSE](LICENSE).
