version (1.38 KB) by Richard Moore
Determine the size of a folder/directory in bytes, including all subdirectories.


Updated 18 Apr 2013

View License

bytes = DirSize('pathOfInterest');

Sometimes I write a script that needs to know how large directories are. I couldn't find a function to already do this, so took a stab at it.

Cite As

Richard Moore (2022). DirSize (https://www.mathworks.com/matlabcentral/fileexchange/41300-dirsize), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2012b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Inspired: DirSizePretty

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!