Jump to content

mkdir problems with PHP version 4.4.1


matt.xx

Recommended Posts

Hi Guys,

 

I'm having a lot of trouble getting the mkdir command to work.

 

I can't get my exact code that i'm using, as i can't remotely access my work computer, but it goes a little something like this:

 

<?php
if(!is_dir("Redundant_Files/Resources/Public Documents/Quality management/Resources Centre")){

//Now this works in php 5 i believe.. but php 4 only expects 2 parameters
//mkdir("Redundant_Files/Resources/Public Documents/Quality management/Resources Centre", 0700, true);

//This is what i'm trying to use now, i've tried it without 0700 aswell, also tried with 0777 etc
mkdir("Redundant_Files/Resources/Public Documents/Quality management/Resources Centre", 0700);

}
?>

 

This is roughly what it says:

 

directory not found  in E:\Create\cleanup\index.php on line 155

 

(PHP Rename ==> ("../Resources/Public Documents/Quality management/Resources Centre/external vrb membership.doc", "Redundant_Files/Resources/Public Documents/Quality management/Resources Centre/external vrb membership.doc");)

 

So i basically run that rename command after creating the directory that mimics the file structure from where the previous file had came from. (i haven't ran this rename script yet, i've been waiting to be able to create the file structure first.

 

The Redundant_Files folder is in the same directory as the index.php file iteself.

 

Anbody got any ideas on how to help me out? it's getting really frustrating now and i'm not able to upgrade the version of php, as the point is to clean up the website before it gets moved onto our new server.

 

Thanks

Matt

Link to comment
https://forums.phpfreaks.com/topic/184760-mkdir-problems-with-php-version-441/
Share on other sites

Hi Guys,

 

I'm having a lot of trouble getting the mkdir command to work.

 

I can't get my exact code that i'm using, as i can't remotely access my work computer, but it goes a little something like this:

 

<?php
if(!is_dir("Redundant_Files/Resources/Public Documents/Quality management/Resources Centre")){

//Now this works in php 5 i believe.. but php 4 only expects 2 parameters
//mkdir("Redundant_Files/Resources/Public Documents/Quality management/Resources Centre", 0700, true);

//This is what i'm trying to use now, i've tried it without 0700 aswell, also tried with 0777 etc
mkdir("Redundant_Files/Resources/Public Documents/Quality management/Resources Centre", 0700);

}
?>

 

This is roughly what it says:

 

directory not found  in E:\Create\cleanup\index.php on line 155

 

(PHP Rename ==> ("../Resources/Public Documents/Quality management/Resources Centre/external vrb membership.doc", "Redundant_Files/Resources/Public Documents/Quality management/Resources Centre/external vrb membership.doc");)

 

So i basically run that rename command after creating the directory that mimics the file structure from where the previous file had came from. (i haven't ran this rename script yet, i've been waiting to be able to create the file structure first.

 

The Redundant_Files folder is in the same directory as the index.php file iteself.

 

Anbody got any ideas on how to help me out? it's getting really frustrating now and i'm not able to upgrade the version of php, as the point is to clean up the website before it gets moved onto our new server.

 

Thanks

Matt

 

Sorry for the double post, but i thought i'd post my solution for anybody who runs into the same problem.

//Create relevant directory before movement 
$Compiledir = $Newdir."Resources/".$Checkdir;
print '<p style="color:green;">Create Folder Structure</p>';
//Alternative to simple mkdir recursive command
$Dsplit = explode("/", $Compiledir);
$Location = "";
foreach($Dsplit as $Directory){
$Location.= $Directory."/";
if(!is_dir($Location)){
		   mkdir($Location, true);
		   }
}

 

I wrote this as an experiment and it worked for me. - solved.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.