list_files

SummerySummery

Returns a listing of all files in the specified folder and all subdirectories up to 100 levels deep.

Syntax

list_files( string $folder = '', int $levels = 100, string[] $exclusions = array() )

DescriptionDescription

The depth of the recursiveness can be controlled by the $levels param.

ParametersParameters

$folder

(string) (Optional) Full path to folder.

Default value: ''

$levels

(int) (Optional) Levels of folders to follow, Default 100 (PHP Loop limit).

Default value: 100

$exclusions

(string[]) (Optional) List of folders and files to skip.

Default value: array()

ReturnReturn

(bool|string[]) False on failure, else array of files.

SourceSource

File: wp-admin/includes/file.php


			

ChangelogChangelog

Changelog
Version Description
4.9.0 Added the $exclusions parameter.
2.6.0 Introduced.
Scroll to Top