note 72553 deleted from function.ftp-nlist by nlopess

From: Date: Wed, 24 Jan 2007 11:04:24 +0000
Subject: note 72553 deleted from function.ftp-nlist by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-122132@lists.php.net to get a copy of this message
Note Submitter: philihp at philihp dot net ---- un peu différent... <? function filecollect($cid,$dir='.') { static $flist=array(); if ($files = ftp_nlist($cid,$dir)) { foreach ($files as $file) { if (ftp_size($cid, $file) == "-1"){filecollect($cid,$file);} else { $expl=explode('/',$file); if(is_array($expl)) {$a='[\''.$expl[0].'\']'; for($i=1;$i<count($expl);$i++) {$a=$a.'[\''.$expl[$i].'\']';} $a=$a.'=\''.$expl[$i-1].'\''; eval("\$flist".$a.";"); } else{$flist[]=$file;} } } return $flist; } } $conn_id = ftp_connect('domaine.fr') or die("Couldn't connect to server"); if (@ftp_login($conn_id, 'user', 'pwd')) { $filelist = filecollect($conn_id); echo "<pre>"; print_r($filelist); echo "</pre>"; } ?>

« previous php.notes (#122132) next »