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? Quote Link to comment 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(). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.