note 57470 deleted from function.mkdir by felipe
| From: | felipe@php.net | Date: | Mon, 10 Dec 2007 18:12:35 +0000 |
| Subject: | note 57470 deleted from function.mkdir by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-133259@lists.php.net to get a copy of this message | ||
Note Submitter: greg at NOserberusSPAM dot co dot uk
----
Recursive directory creation routine.
This could be adapted to work on Windows but this code is written for use on a Linux/Unix based
machine.
<?php
$working_directory = '/path/to/my/work';
do {
$dir = $working_directory;
while (!@mkdir($dir,0777)) {
$dir = dirname($dir);
if ($dir == '/' || is_dir($dir))
break;
}
} while ($dir != $working_directory);
?>