Re: Recursively create directories

From: Date: Wed, 16 May 2001 03:15:50 +0000
Subject: Re: Recursively create directories
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-52981@lists.php.net to get a copy of this message
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. On 5/14/01 3:01 PM, "Darin Isola" <shag_bot@yahoo.com> wrote: > hi all, > > does anyone have a function to recursively create directories? > > heres what I have so far: > > $dir = "dir1/dir2/dir3/dir4"; > $dir_array = explode("/",$dir); > > foreach($dir_array as $current_dir) { > if(! is_dir($DOCUMENT_ROOT."/".$current_dir) ) { > mkdir($DOCUMENT_ROOT."/".$current_dir,0700); > } > } > > which works, but this will only create these dirs off the document > root, not recursivley underneth one another. im getting stuck on how > to remember what directory has been created and travel down from there. > > can anyone help a brother out? > > > __________________________________________________ > Do You Yahoo!? > Yahoo! Auctions - buy the things you want at great prices > http://auctions.yahoo.com/

« previous php.general (#52981) next »