$connection = ftp_connect($host);
if(!$connection){
echo "Can't connect to $host ($login:$password)\n";
#print_r(error_get_last());
ftp_close($connection);
exit();
}
ftp_login($connection, $login, $password);
ftp_pasv($connection, TRUE);
$files_list = ftp_nlist($connection, $path);
print_r($files_list);
for($i = 0; $i< count($files_list); $i++){
if( strstr($files_list[$i], '.') ){
//echo "FILE: $files_list[$i]\n";
unset($files_list[$i]);
}
}
print_r($files_list);
echo 'Ok';
А вот вывод:
Array
(
[0] => /httpdocs/favicon.ico
[1] => /httpdocs/mobile.html
[2] => /httpdocs/g
[3] => /httpdocs/index.html
[4] => /httpdocs/.
[5] => /httpdocs/member.html
[6] => /httpdocs/sitemap.xml
[7] => /httpdocs/animated_favicon1.gif
[8] => /httpdocs/rakuten.html
[9] => /httpdocs/y_key_8866d9fb86f18b30.html
[10] => /httpdocs/robots.txt
[11] => /httpdocs/..
[12] => /httpdocs/bbs.html
[13] => /httpdocs/version.php
[14] => /httpdocs/css
[15] => /httpdocs/nas
[16] => /httpdocs/googlee7e5921970ceb672.html
[17] => /httpdocs/about.html
[18] => /httpdocs/images
)
Array
(
[2] => /httpdocs/g
[10] => /httpdocs/robots.txt
[11] => /httpdocs/..
[12] => /httpdocs/bbs.html
[13] => /httpdocs/version.php
[14] => /httpdocs/css
[15] => /httpdocs/nas
[16] => /httpdocs/googlee7e5921970ceb672.html
[17] => /httpdocs/about.html
[18] => /httpdocs/images
)
Ok
Как видите, не все элементы удалились. Почему так произошло?