PHP Salt


A little dash of PHP... my collection of php functions

Version: 2.13.2
Last Build: October 09, 2016 21:15pm (PST)

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; }
$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:


See Also

And a shot out to:

LinuxSimple - www.linuxsimple.com
PHP - php.net
Fedora Server - getfedora.com
Shameless ads to pay for site