<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$ftp_user_name = '*';
$ftp_user_pass = '*';
$ftp_server = '*';
if (false === ($conn_id = @ftp_connect($ftp_server))) {
exit('connect is invalid');
}
if (false === ($login = @ftp_login($conn_id, $ftp_user_name, $ftp_user_pass))) {
exit('login invalid');
}
$pathes = file('files_to_delete.txt');
foreach ($pathes as $path) {
$path = trim($path);
ftp_rmdirr($path, $conn_id);
}
ftp_close($conn_id);
function ftp_rmdirr($path, $handle) {
if (!(@ftp_rmdir($handle, $path) || @ftp_delete($handle, $path)))
{
$list = ftp_nlist($handle, $path);
if (!empty($list))
foreach($list as $value)
ftp_rmdirr($value, $handle);
}
@ftp_rmdir($handle, $path);
}
?>