Good day.
I need to retreive a list of directories and then a list of all files inside those directories via FTP.
What I have accomplished so far is the following:
<?
$ftp_server = "ftp.foobar.com";
$ftp_user = "foo";
$ftp_pwd = "bar";
$conn_id = ftp_connect($ftp_server);
ftp_login($conn_id, $ftp_user, $ftp_pwd);
$contents=ftp_rawlist($conn_id, '.');
print_r($contents);
ftp_close($conn_id);
?>
What this gives me is a list of all files and directories from where i logged in as an array. What I want to do is just limit it to the directories from where I logged in, and then retrieve the listings inside of the directory.
What I get is:
[0] => total 576
[1] => drwxr-xr-x 2 root root 4096 Oct 12 04:24 1110
[2] => -rw-r--r-- 1 root root 0 Oct 12 04:24 file2.xml.gz
[3] => drwxr-xr-x 2 root root 4096 Oct 12 04:28 1154
[4] => -rw-r--r-- 1 root root 0 Oct 12 04:28 file.xml.gz
SO for me to get just the directories (which are only numbered) I have to attack the array with a bunch of commands to strip out any of the gz files. Then I have to cd into each directory in the array and create a listing there.
Is there not an easier way of doing this???
TIA
Phil