note 68207 added to function.mkdir
| From: | kunglaatgmaildotcom at osu1 dot php dot net | Date: | Tue, 18 Jul 2006 12:41:02 +0000 |
| Subject: | note 68207 added to function.mkdir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-114882@lists.php.net to get a copy of this message | ||
Somehow the recursive version of mkdir didn't work for me on Mac and the workaraounds listed
below alsow didn't work for me, so heres my solution:
<?php
function mkdir_r($dirName, $rights=0777){
$dirs = explode('/', $dirName);
$dir='';
foreach ($dirs as $part) {
$dir.=$part.'/';
if (!is_dir($dir) && strlen($dir)>0)
mkdir($dir, $rights);
}
}
?>
Tested and works ;)
----
Server IP: 212.47.220.13
Probable Submitter: 213.35.231.92
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.mkdir.php
Edit -- http://master.php.net/note/edit/68207
Del: integrated -- http://master.php.net/note/delete/68207/integrated
Del: useless -- http://master.php.net/note/delete/68207/useless
Del: bad code -- http://master.php.net/note/delete/68207/bad+code
Del: spam -- http://master.php.net/note/delete/68207/spam
Del: non-english -- http://master.php.net/note/delete/68207/non-english
Del: in docs -- http://master.php.net/note/delete/68207/in+docs
Del: other reasons-- http://master.php.net/note/delete/68207
Reject -- http://master.php.net/note/reject/68207
Search -- http://master.php.net/manage/user-notes.php