Jump to content


Photo

creating 1000 folders


  • Please log in to reply
2 replies to this topic

#1 CircularStopSign

CircularStopSign
  • Members
  • PipPipPip
  • Advanced Member
  • 44 posts

Posted 12 September 2006 - 10:38 PM

i need to create 1000 folders, 1-1000 but i dont feel like creating it all by hand, is there any loop code that i could use to do this for my web server?

#2 gijew

gijew
  • Members
  • PipPipPip
  • Advanced Member
  • 240 posts
  • LocationCalifornia

Posted 12 September 2006 - 10:52 PM

you could just do...

for ($i=1;$i <= 1000;$i++) {
  mkdir("folder_$i");
}

Of course that's just something simple.  Probably want to make sure the directory you're writing to has read/write perms.  Just look up mkdir() function in the manual and that should get you on the right path.  Oh yeah, it'll probably time out so you'll probably want to set your max_execution_time() in your php.ini file to something higher than 30 seconds.
I'm considered good looking in some countries

#3 ronverdonk

ronverdonk
  • Members
  • PipPipPip
  • Advanced Member
  • 277 posts
  • LocationNetherlands

Posted 12 September 2006 - 10:53 PM

Use the PHP mkdir command, see http://nl3.php.net/m...ction.mkdir.php

bool mkdir ( string pathname [, int mode [, bool recursive [, resource context]]] )


Attempts to create the directory specified by pathname.


Ronald  8)
RTFM is an almost extinct art form, it should be subsidized.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users