note 100592 added to function.ftp-nlist
| From: | rogerioluizjr at gmail dot com | Date: | Mon, 25 Oct 2010 19:52:24 +0000 |
| Subject: | note 100592 added to function.ftp-nlist | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-173448@lists.php.net to get a copy of this message | ||
public function treeFtp($start = '/'){
$ftp = connFtp();
$files = array();
if(ftp_is_dir($ftp, $start)){
ftp_chdir($ftp, $start);
$arquivos = ftp_nlist($ftp, '');
foreach($arquivos as $arquivo){
$filePath = $start . '/' . $arquivo;
if(ftp_is_dir($ftp, $arquivo)){
$files = array_merge($files, treeFtp($filePath));
}else{
array_push($files, $filePath);
}
}
}else{
$files = false;
}
return $files;
}
function ftp_is_dir($ftp, $path) {
if(ftp_size($ftp, $path) == '-1'){
return true; // Is directory
}else{
return false; // Is file
}
}
function connFtp(){
$host = "255.255.255.0";
$user = "xxx";
$senha = "xxxx";
$conn = ftp_connect($host) or die("Couldn't connect to $host");
ftp_login($conn, $user, $senha);
ftp_pasv($conn,true);
if(!$conn){
return false;
}else{
return $conn;
}
}
----
Server IP: 187.16.23.134
Probable Submitter: 189.57.25.10
----
Manual Page -- http://www.php.net/manual/en/function.ftp-nlist.php
Edit -- https://master.php.net/note/edit/100592
Del: integrated -- https://master.php.net/note/delete/100592/integrated
Del: useless -- https://master.php.net/note/delete/100592/useless
Del: bad code -- https://master.php.net/note/delete/100592/bad+code
Del: spam -- https://master.php.net/note/delete/100592/spam
Del: non-english -- https://master.php.net/note/delete/100592/non-english
Del: in docs -- https://master.php.net/note/delete/100592/in+docs
Del: other reasons-- https://master.php.net/note/delete/100592
Reject -- https://master.php.net/note/reject/100592
Search -- https://master.php.net/manage/user-notes.php