Wolfram Research

Function Repository Resource:

DirectorySize

Source Notebook

Find the total size of a directory

Contributed by: Arnoud Buzing

ResourceFunction["DirectorySize"][dir]

returns the byte count for dir as a quantity.

Details and Options

The total includes the content of all subdirectories.

Examples

Basic Examples

Get the size of the current working directory:

In[1]:=
ResourceFunction["DirectorySize"][Directory[]]
Out[1]=

Find the size of the Wolfram System installation directory:

In[2]:=
ResourceFunction["DirectorySize"][$InstallationDirectory]
Out[2]=

Properties and Relations

Empty directories have zero bytes:

In[3]:=
ResourceFunction["DirectorySize"][CreateDirectory[]]
Out[3]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Resource History

License Information