Re: [PHP] Recursively create directories

2001-05-15 Thread Gregory Hernandez
Hello. I just registered to the listserv about two weeks (my 1st time typing here). I'm just curious, if you don't mind me asking. I'm just trying to learn more. But, would someone list any scenarios in which one would want to create directories recursively by using php? Thanks in advance.

Re: [PHP] Recursively create directories

2001-05-15 Thread Markus Fischer
- Original Message - From: "Philip Hallstrom" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, May 15, 2001 7:01 PM Subject: Re: [PHP] Recursively create directories > > > >foreach($dir_array as $current

Re: [PHP] Recursively create directories

2001-05-15 Thread Philip Hallstrom
If you're on unix, and don't mind a system call you could do: system("/bin/mkdir -p $dir"); >From the man page for mkdir. -p Create intermediate directories as required. If this option is not specified, the full path prefix of each operand must already exist. Intermediate directories are

Re: [PHP] Recursively create directories

2001-05-15 Thread Adam Wright
This should do what you want... $dir = "dir1/dir2/dir3/dir4"; $dir_array = explode("/",$dir); $full_path = ""; foreach($dir_array as $current_dir) { $full_path .= "/$current_dir"; if (!is_dir($DOCUMENT_ROOT . $full_path)) { mkdir($DOCUMENT_ROOT."/" .$full_path,0700); } } adamw -