Mecha CMS

Working with files and folders.

File::explore()

List files and folders from a folder.

1.0.02.0.02.2.0static
File::explore($folder = ROOT, $deep = false, $fail = []);
File::explore([$folder = ROOT, $x = null], $deep = false, $fail = []);

Example:

$A = File::explore('.\path\to\folder');
$B = File::explore('.\path\to\folder', true);

$C = File::explore(['.\path\to\folder', 1], true); // Get file(s) only
$D = File::explore(['.\path\to\folder', 0], true); // Get folder(s) only
$E = File::explore(['.\path\to\folder', 'css'], true); // Get file(s) only with extension `css`
$F = File::explore(['.\path\to\folder', 'css,js'], true); // Get file(s) only with extension `css` and `js`

Result:

$A = [
    '.\path\to\folder\file-1.txt' => 1,
    '.\path\to\folder\file-2.txt' => 1,
    '.\path\to\folder\folder-1' => 0,
    '.\path\to\folder\folder-2' => 0,
    '.\path\to\folder\folder-3' => 0
];

$B = [
    '.\path\to\folder\file-1.txt' => 1,
    '.\path\to\folder\file-2.txt' => 1,
    '.\path\to\folder\folder-1' => 0,
    '.\path\to\folder\folder-1\file-1.txt' => 1,
    '.\path\to\folder\folder-1\file-2.txt' => 1
    '.\path\to\folder\folder-1\file-3.txt' => 1
    '.\path\to\folder\folder-2' => 0
    '.\path\to\folder\folder-2\file-1.txt' => 1
    '.\path\to\folder\folder-3' => 0
    '.\path\to\folder\folder-3\file-1.txt' => 1
    '.\path\to\folder\folder-3\file-3.txt' => 1
    '.\path\to\folder\folder-3\folder-1' => 0
    '.\path\to\folder\folder-3\folder-1\file-1.txt' => 1
    '.\path\to\folder\folder-3\folder-1\file-2.txt' => 1
    '.\path\to\folder\folder-3\folder-1\file-3.txt' => 1
];