WPDev.one
Core Function
View Source on Trac ↗

recurse_dirsize()

recurse_dirsize( mixed $directory, mixed $exclude = null, mixed $max_execution_time = null, mixed $directory_cache = null )

Gets the size of a directory recursively.

Parameters 4 required

Name / Type Description
$directory
string

Full path of a directory.

Required
mixed

(string | string[]) $exclude Optional. Full path of a subdirectory to exclude from the total, or array of paths. Expected without trailing slash(es). Default null.

Required
int

$max_execution_time Optional. Maximum time to run before giving up. In seconds. The timeout is global and is measured from the moment WordPress started to load. Defaults to the value of `max_execution_time` PHP setting.

Required
array

$directory_cache Optional. Array of cached directory paths. Defaults to the value of `dirsize_cache` transient.

Required

Return Value

((int)
| false | null) Size in bytes if a valid directory. False if not. Null if timeout.

Function Information

Since Version
MU (3.0.0)
Source File
wp-includes/functions.php
Advertisement