All pastes #129569 Raw Edit

Anonymous

public text v1 · immutable
#129569 ·published 2006-08-13 15:28 UTC
rendered paste body
# Function which lists a directory and all of its subdirectories
			function 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;
			}