Return to Snippet

Revision: 51724
at October 2, 2011 06:22 by stz184


Initial Code
function listing($dir) {
	$result = array();
	foreach (glob($dir.'/*') as $filename) {
		if(is_file($filename)) {
			$result[] = $filename;
		}
		else {
			
			$result = array_merge(listing($filename), $result);
		}
	}
	return $result;
}

Initial URL

                                

Initial Description
This function accept one parameter - string, dir path. It will return a array, containing all files found in this and all its subfolders.

Initial Title
List files in folder

Initial Tags

                                

Initial Language
PHP