All pastes #129607 Raw Edit

Anonymous

public php v1 · immutable
#129607 ·published 2006-08-13 15:32 UTC
rendered paste body
# Function which lists a directory and all of its subdirectoriesfunction listTree($arrPath = array(".")){	$arrTree = array();		# Loop in all top directories	for($i = 0; $i < sizeOf($arrPath); $i ++)	{		# Add directory to array		array_push($arrTree, $arrPath[$i]);			# List all directories		$arrDirectory = glob($arrPath[$i] . "/*", GLOB_ONLYDIR);				# Loop in all directories		for($j = 0; $j < sizeOf($arrDirectory); $j ++)		{			# Add directory to array			array_push($arrTree, $arrDirectory[$j]);					# List all subdirectories			$arrSubDirectory = glob($arrDirectory[$j] . "/*", GLOB_ONLYDIR);						# Loop in all subdirectories			for($k = 0; $k < sizeOf($arrSubDirectory); $k ++)			{				# Add subdirectory to array				array_push($arrTree, $arrSubDirectory[$k]);			}		}	}		return $arrTree;}