Created
March 29, 2014 22:29
-
-
Save musoftware/bf5a3e4cebc0ecb8ba1d to your computer and use it in GitHub Desktop.
Search Ftp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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