creating multiple directory

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
webgroundz
Forum Commoner
Posts: 58
Joined: Thu Jun 21, 2007 1:20 am
Location: Philippines

creating multiple directory

Post by webgroundz »

hello guys!, do you have any idea how to create multiple directory?.

thanks...any suggestion is highly appreciated.. :) :) :)
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

multiple calls to mkdir() ?
User avatar
webgroundz
Forum Commoner
Posts: 58
Joined: Thu Jun 21, 2007 1:20 am
Location: Philippines

Post by webgroundz »

yes, is that possible?.thanks.. :)
User avatar
webgroundz
Forum Commoner
Posts: 58
Joined: Thu Jun 21, 2007 1:20 am
Location: Philippines

Post by webgroundz »

here's my sample code

Code: Select all

$this->destination('test1/test2/test3');
			$dir = explode('/', $this->destination_dir);
			foreach ($dir as $this->destination_dir)
			{
				if(!is_dir($this->destination_dir))
				{
					$directory .= $this->createDirectory($this->destination_dir, 0777);
				}
			}
what is wrong with my sample code snippet?.thanks. :)
miro_igov
Forum Contributor
Posts: 485
Joined: Fri Mar 31, 2006 5:06 am
Location: Bulgaria

Post by miro_igov »

I believe you should change it to :

Code: Select all

$this->destination('test1/test2/test3');
$dir = explode('/', $this->destination_dir);
$temp = '';
foreach ($dir as $this->destination_dir)
 {
   $temp .= $this->destination_dir.'/';
   if(!is_dir($temp))
   {
      $directory .= $this->createDirectory($temp, 0777);
   }
}
User avatar
webgroundz
Forum Commoner
Posts: 58
Joined: Thu Jun 21, 2007 1:20 am
Location: Philippines

Post by webgroundz »

thanks bro, it work fine now... :D :D :D
Post Reply