Skip to content

Instantly share code, notes, and snippets.

@musoftware
Created March 29, 2014 22:29
Show Gist options
  • Save musoftware/bf5a3e4cebc0ecb8ba1d to your computer and use it in GitHub Desktop.
Save musoftware/bf5a3e4cebc0ecb8ba1d to your computer and use it in GitHub Desktop.
Search Ftp
function list_all_files($conn_id, $path){
$buff = ftp_rawlist($conn_id, $path);
$res = parse_rawlist( $buff) ;
static $flist = array();
if(count($res)>0){
foreach($res as $result){
// verify if is dir , if not add to the list of files
if($result['size']== 0){
// recursively call the function if this file is a folder
list_all_files($conn_id, $path.'/'.$result['name']);
}
else{
// this is a file, add to final list
$flist[] = $result;
}
}
}
return $flist;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment