directory size

Prev Next

Function Names

directory size

Description

Returns the total number of bytes used by all files specified in the directory, including all their subdirectories. Hidden and inaccessible files will not be counted.

Call as: function

Restrictions

Indirect parameter passing is disabled

Parameter count

1

Parameters

No.TypeDescription
Opt. 1
input
string path and directory name

Specify the directory name (subdirectory in working directory) or path name. Do not use wildcards.

Return value

TypeDescription
numeral Total size

Size of all files identified, summed, unit is bytes.

Exceptions

Specified directory not found or not existing

Examples

      // Function 'string' adds thousand separators to make numbers readable
      echo( str( directory size( system info[bin directory] ), "#,000", local ) );
      echo( str( directory size( "Images" ), "#,000", local ) );

Output

5'047'420
26'214'097
Try it yourself: Open LIB_Function_directory_size.b4p in B4P_Examples.zip. Decompress before use.