note 60541 deleted from function.mkdir by nlopess
| From: | nlopess@php.net | Date: | Tue, 10 Jan 2006 19:37:14 +0000 |
| Subject: | note 60541 deleted from function.mkdir by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-101512@lists.php.net to get a copy of this message | ||
Note Submitter: Richard Bowman
----
the following code generates a directory (if it exists) and all non-existing parent directories too.
function ensuredir($directory){
//if a directory does not exist, create it
if(! is_dir($directory)){
ensuredir(dirname($directory)); //make sure parent exists
mkdir($directory);
}
}