Jump to content

Help with mkdir


Perad

Recommended Posts

Could someone help me get my head around the mkdir() function.

 

I have the following.

 

$root = getcwd().'/cities/'

 

This is where I want to make the folder.

 

I want to make a folder containing the variable $name.

 

So the folder path will be

 

$root = getcwd().'/cities/'.$name;

 

How do I set this with getcwd. Do I just specify the complete path and it will automatically generate the new folder.. i.e.

 

mkdir($root, 0777);

 

Or is there something more to it?

 

 

 

My second question. How can I change folder name with out edited the contents of the folder. Is there another function for this?

Link to comment
https://forums.phpfreaks.com/topic/97958-help-with-mkdir/
Share on other sites

How do I set this with getcwd. Do I just specify the complete path and it will automatically generate the new folder.. i.e.

 

mkdir($root, 0777);

 

Or is there something more to it?

 

Why not try it? If you need to create a dir more than one dir deep (ie you have an empty /foo and want to create /foo/bar/bob) you'll need to look at the third argument, recursive.

 

My second question. How can I change folder name with out edited the contents of the folder. Is there another function for this?

 

Yes, rename().

Link to comment
https://forums.phpfreaks.com/topic/97958-help-with-mkdir/#findComment-501185
Share on other sites

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.