Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
mkdir if not exists recursively
<?php
function recur_mkdir($path, $seperator = "/"){
if($path){
$folders = explode($seperator, $path);
if($folders){
$current_path = '';
foreach($folders as $folder){
$current_path .= $folder.$seperator;
if(!file_exists($current_path) && $current_path){
echo "making path {$current_path}","\n";
mkdir($current_path);
}
}
}
return true;
}
else{
return false;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.