note 108507 deleted from function.ftp-mkdir by danbrown

From: Date: Thu, 10 May 2012 16:51:43 +0000
Subject: note 108507 deleted from function.ftp-mkdir by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-187604@lists.php.net to get a copy of this message
Note Submitter: Chris Crawford ---- Create recursive ftp directory: (UPDATED!) function ftp_mkdir_recusive($con_id,$path){ $fullpath = ftp_pwd($con_id); foreach(explode("/",$path) as $part){ $fullpath .= $part."/"; if(empty($part)){ continue; } if(!@ftp_chdir($con_id, $fullpath)){ if(@ftp_mkdir($con_id, $part)){ ftp_chdir($con_id, $part); }else{ return false; } } } return true; } $dir = "/2012/05/02/" if(ftp_mkdir_recusive($con_id,$dir)){ print("Successfully created $dir"); }else{ print("There was a problem while creating $dir"); }

« previous php.notes (#187604) next »