psFileList() Return list of files
Description:
Returns an (array) list of files in a directory Key is set to dir/file
Usage:
$aryList = psFileList("/tmp");
Example:
Code:
function psFileList($wDir) { //print ":$wDir:"; exit(); if (file_exists($wDir) == false) { return; } $res = array(); $handle = opendir($wDir); while (false !== ($entry = readdir($handle))) { if ($entry != "." && $entry != "..") { if ( is_file("$wDir/$entry") == true ) { $res["$wDir/$entry"] = $entry; } } } closedir($handle);
asort($res); return $res; }
Changlelog:
|