Skip to content

Instantly share code, notes, and snippets.

@sharunkumar
Last active April 6, 2023 16:30
Show Gist options
  • Save sharunkumar/8caf903c146cbcc4c341571a6c6562df to your computer and use it in GitHub Desktop.
Save sharunkumar/8caf903c146cbcc4c341571a6c6562df to your computer and use it in GitHub Desktop.
Windows Batch script for getting the size of the folder in bytes. Usage: folder-size "<directory>"
@echo off
setlocal ENABLEDELAYEDEXPANSION
set firstline=.
set secondline=.
@FOR /F "tokens=1 delims=^^" %%G IN ('dir /s /a "%~1"') DO (
set firstline=!secondline!
set secondline=%%G
)
echo !firstline!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment