Share an efficient tool for quickly identifying the largest or most numerous directories when disk space is running low.
github.com·2h·
Discuss: DEV
🐚Shell Scripting
Preview
Report Post

Introduction

This program scans specified directories (or the current directory by default) to identify the top N largest subdirectories by total size and the top N subdirectories with the most files. It uses an efficient bottom-up aggregation algorithm to calculate sizes and file counts, avoiding redundant traversals.

Key Features:

  • High-Performance Scanning: Utilizes Go’s filepath.WalkDir (significantly faster than filepath.Walk) for efficient directory traversal.
  • Smart Aggregation: Implements a Bottom-Up aggregation algorithm. Unlike traditional shell scripts that often recursively recalculate or use redundant loops, this tool scans the file system only once and aggregates data from the deepest subdirectories up to the root instantly.
  • **User-Frien…

Similar Posts

Loading similar posts...