Skip to content

EnsignRutherford/FolderSizes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FolderSizes

Displays the sizes of subfolders in a directory. Copyright (C) 2026 by Russ Le Blang

This was created solely with Github Copilot and prompting. No user intervention within the code itself. This is my example of "Results Driven Development". Prompting continued until the expected behavior was obtained.

Usage

FOLDERSIZES [--SORT name|size] [--PATH folder] [--DEPTH n] [--CSV=file] [--JSON=file] [--BYTES]

Options

Option Description
--HELP Displays this help message.
--SORT name|size Sorts output by folder name or size. Default is name.
--PATH folder Specifies the folder to scan. Default is the current directory.
--DEPTH n Limits recursion depth. Default is unlimited.
--CSV=file Exports results to a CSV file.
--JSON=file Exports results to a JSON file.
--BYTES Shows sizes in raw bytes instead of human-readable format.

Shorthand Syntax

FolderSizes supports convenient shorthand notation:

  • name or size - Can be used without --SORT prefix (e.g., foldersizes size)
  • folder path - Can be used without --PATH prefix (e.g., foldersizes C:\Data)
  • Combine both - foldersizes size C:\Data

Examples

# Display subfolders in current directory, sorted by name
foldersizes

# Sort by size (largest first)
foldersizes size

# Scan a specific directory
foldersizes C:\Data

# Combine sort and path
foldersizes size "E:\PC\PC Games"

# Using explicit flags
foldersizes --SORT size
foldersizes --PATH "E:\PC\PC Games"

# Limit recursion depth to 1 level
foldersizes --DEPTH 1

# Export results to CSV
foldersizes --CSV=output.csv

# Display sizes in raw bytes
foldersizes --BYTES

# Show help
foldersizes --HELP

Features

  • Human-readable sizes - Automatically converts bytes to KB, MB, GB, TB
  • Raw byte display - Use --BYTES flag for precise byte counts
  • Summary statistics - Shows total size, folder count, and average folder size
  • Multiple sort options - Sort by name or size
  • Export formats - CSV and JSON export capabilities
  • Recursion control - Limit folder depth scanning
  • Fast performance - Parallel processing on PowerShell 7+
  • PS5.x compatible - Falls back to sequential processing on PowerShell 5.x

Sample Output

Folder Name      Total Size
---------------------------
backup            393.14 KB
resources         171.00 KB
---------------------------
Total: 564.13 KB
Folders: 2 | Average: 282.07 KB

Requirements

  • PowerShell 5.1 or higher
  • Visual C++ redistributable (for executable version)

Build

To compile the PowerShell script into an executable:

.\make.bat

This creates foldersizes.exe with an embedded icon using PS2EXE.

About

Displays the sizes of subfolders in a directory.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors