Skip to content

About

ストレージの奥に眠る巨大ディレクトリを、数秒で炙り出す。

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

Repository files navigation

astral-drive

ストレージ内の巨大ディレクトリを高速に検出する CLI ツール. Go の Worker Pool パターンによる並列スキャンで,数万ディレクトリを数秒で分析できる.

デモ GIF はこちらから確認できます.

インストール

GitHub Releases から各 OS 向けのバイナリをダウンロードしてください. 詳細な手順は INSTALL.md を参照してください.

# Linux / macOS(ワンライナー)
curl -fsSL https://raw.githubusercontent.com/torifo/astral-drive/main/scripts/install.sh | bash

# ソースからビルド
git clone https://github.com/torifo/astral-drive
cd astral-drive && go build -o astral-drive .

使い方

astral-drive [flags] [path]

Flags:
  -n int        表示件数 (デフォルト: 20)
  -w int        Worker 数 (デフォルト: CPU コア数 × 2)
  -exclude      除外するディレクトリ名(カンマ区切り)
  -no-color     カラー出力を無効化
  -h            ヘルプ表示

推奨コマンド

Windows(PowerShell)

# C: ドライブ全体をスキャン(上位 20 件)
astral-drive -n 20 C:\

# 不要なフォルダを除いて高速スキャン
astral-drive -n 20 -exclude node_modules,.git C:\

# 複数ドライブを個別にスキャン
astral-drive -n 10 D:\

WSL2 / Linux / macOS

# ホームディレクトリをスキャン
astral-drive -n 20 /home

# 開発フォルダを node_modules 除外で高速スキャン
astral-drive -n 20 -exclude node_modules,.git,.venv ~/

# ルート全体をスキャン(時間がかかる場合あり)
astral-drive -n 30 /

# Worker 数を絞ってスキャン
astral-drive -w 4 -n 20 /var

出力例

   #   SIZE        PATH
  ---  ----------  --------------------------------------------------
    1    55.9 GB   C:\Users\user\AppData\Local\Packages\...Ubuntu...
    2    44.2 GB   C:\Users\user\AppData\Local\Docker\wsl\disk
    3     4.1 GB   /home/user/data-pipeline/data/raw/srtm
    4   975.6 MB   /home/user/.local/lib/python3.10/site-packages/nvidia

Scanned 50,691 dirs in 2.3s

デモ

Windows

Windows demo

Linux / WSL2

Linux demo

Windows + Linux 連続スキャン

Combined demo

開発フロー(Windows 編集 → WSL2 ビルド)

ソースは Windows で編集し,ビルドは WSL2 Ubuntu で行う構成を前提としている.

ソースを WSL2 へ同期

# Windows PowerShell から実行
powershell -ExecutionPolicy Bypass -File scripts\sync-wsl.ps1

WSL2 でビルド・実行

# WSL2 端末内で実行
cd ~/devops/CLI/astral-drive

make build      # Linux バイナリ
make test       # ユニットテスト
make build-win  # Windows バイナリをクロスコンパイル
make build-all  # 全プラットフォーム
make clean      # 成果物を削除

アーキテクチャ

Worker Pool Pattern を採用し,複数の Worker が Channel からディレクトリパスを受け取り os.ReadDir を実行する並行構造.

[main] --> [env.Detect()] --> [scanner.Run()] --> [processor.TopN()] --> [ui.Render()]
                                    |
                     +--------------+--------------+
                     |              |              |
                  Worker1        Worker2        Worker3
モジュール 役割
internal/env OS 判定・スキャン起点パスの列挙
internal/scanner Worker Pool による並列ディレクトリ走査
internal/processor サイズ降順ソート・上位 N 件抽出
internal/ui カラム表示・単位変換・ANSI カラー出力

About

ストレージの奥に眠る巨大ディレクトリを、数秒で炙り出す。

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages