Well, you need to parse thru the files in one directory and find the directories in them and then loop thru
each. This is not very tricky. Here is a routine that I borrowed from StackOverflow that should do it for you.
[php]
public function ftp_dir_loop($path) {
$ftpContents = ftp_nlist($this->ftp_connection, $path);
foreach ( $ftpContents as $file ) {
if (strpos($file, ‘.’) === false) {
$this->ftp_dir_loop($this->ftp_connection, $file);
}
if (in_array(pathinfo($file, PATHINFO_EXTENSION), $this->accepted_file_types)) {
$this->html_file_paths[$path][] = substr($file, strlen($path) + 1);
}
}
}
[/php]
This is a function that you call and it re-calls itself as needed. You would need to test it to make sure it
returns the file list you really need, but, it should give you a solid starting point.
If the program (web page with your code) is on the same server, you can do it without FTP by using the
function " RecursiveDirectoryIterator "… It works well for on-server code, but, of course does not work
if FTP to another server is needed.
Hope that helps…