create a similar ".. /.. /.. /xxx/xxx.txt "The catalogue is very good!
function Mkdirs ($path, $mode = 0777)//creates directory tree recursively
{
$dirs = explode ('/', $path);
$pos = Strrpos ($path, ".");
if ($pos = = False) {//Note:three equal signs
Not found, means path ends in a dir not file
$subamount = 0;
}
else {
$subamount = 1;
}
For ($c =0 $c < count ($dirs)-$subamount; $c + +) {
$thispath = "";
for ($cc =0; $cc <= $c; $CC + +) {
$thispath. = $dirs [$CC]. /'';
}
if (!file_exists ($thispath)) {
Print "$thispath <br>";
mkdir ($thispath, $mode);
}
}
}
The original function uses $globals["Dirseparator"] I changed to "/"
function Recur_mkdirs ($path, $mode = 0777)//creates directory tree recursively
{
$GLOBALS ["Dirseparator"]
$dirs = Explode ($GLOBALS ["Dirseparator"], $path);
$pos = Strrpos ($path, ".");
if ($pos = = False) {//Note:three equal signs
Not found, means path ends in a dir not file
$subamount = 0;
}
else {
$subamount = 1;
}
For ($c =0 $c < count ($dirs)-$subamount; $c + +) {
$thispath = "";
for ($cc =0; $cc <= $c; $CC + +) {
$thispath. = $dirs [$CC]. $GLOBALS ["Dirseparator"];
}
if (!file_exists ($thispath)) {
Print "$thispath <br>";
mkdir ($thispath, $mode);
}
}
}