Scan All Directories And Files Php

[Solved] Scan All Directories And Files Php | Php - Code Explorer | yomemimo.com
Question : scan all directories and files php

Answered by : brave-batfish-zig5sfbvefc1

<?php
function getDirContents($dir, &$results = array()) { $files = scandir($dir); foreach ($files as $key => $value) { $path = realpath($dir . DIRECTORY_SEPARATOR . $value); if (!is_dir($path)) { $results[] = $path; } else if ($value != "." && $value != "..") { getDirContents($path, $results); $results[] = $path; } } return $results;
}
var_dump(getDirContents('/xampp/htdocs/WORK'));

Source : https://stackoverflow.com/questions/24783862/list-all-the-files-and-folders-in-a-directory-with-php-recursive-function/24784144 | Last Update : Thu, 18 Nov 21

Answers related to scan all directories and files php

Code Explorer Popular Question For Php