Return to Snippet

Revision: 31930
at September 16, 2010 01:26 by iloveitaly


Initial Code
function create_path($targetPath) {
	$targetClimber = $targetPath;
	
	while(!file_exists($targetPath)) {			
		// if the 'climber' exists then reset to the top of the directory and drill down until we find a directory that doesn't exist
		if(file_exists($targetClimber)) {
			$targetClimber = $targetPath;
		} else if(file_exists(dirname($targetClimber))) {
			mkdir($targetClimber, 0775);
		} else {
			$targetClimber = dirname($targetClimber);
		}
	}
}

Initial URL


Initial Description


Initial Title
Create Directory Path

Initial Tags
path, directory

Initial Language
PHP