Perad Posted March 26, 2008 Share Posted March 26, 2008 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 More sharing options...
trq Posted March 26, 2008 Share Posted March 26, 2008 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.