Skip to content

dale8nson/dirsize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dirsize

A simple command-line utility to calculate the total size of a directory and all its subdirectories, with optional .gitignore support.

Installation

cargo install --path .

Usage

dirsize <PATH> [OPTIONS]

Options:

Flag Description
-g, --gitignore Ignore paths listed in .gitignore (if one exists in the target directory)

Examples

Get the total size of the current directory:

dirsize .

Get the size of a project, excluding build artifacts and other gitignored files:

dirsize ~/dev/my-project --gitignore

Output is automatically scaled to the most appropriate unit (B, KB, MB, GB, or TB):

1.23 GB

How it works

dirsize recursively walks a directory tree, summing the size of every file it encounters. When --gitignore is passed, it reads the .gitignore at the root of the target directory, resolves each pattern via glob expansion, and skips any matching paths during traversal.

Built with

  • clap — argument parsing
  • glob.gitignore pattern matching

About

A simply command line utility written in Rust to calculate the size of a project by recursively iterating through a directory and its subdirectories

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages