Looking for a little help: Scanning all files and directories

Ok, first off, I do not want to be given a fully working script. I am trying to exercise my coding abilities.

I'm trying to write a script that will scan every file and directory on a domain and store them in arrays, the files along side their last modified timestamp.

Here is what I've put together so far. I know it's flawed and far from finished.
$results = scandir($_SERVER['DOCUMENT_ROOT']);
	$dirs = array();
	$files = array();

	function fileSort($data){

		if (is_dir($data)) {
			$dirs[] = $data;
		} else if (is_file($data)) {
			$files[] = $data;
			filemtime($data);
		}

		return array($dirs, $files);

	}//END fileSort

	function pathing($results){

		foreach ($results as $result) {
			
			if ($result === '.' OR $result === '..') {
				
			} else {				
				fileSort($result);			
			}//END if Statement		
			
		}//END foreach

		fileSort($dirs);	
		
	}

	pathing($results);

I appreciate any input! :)

Comments

Sign In or Register to comment.