<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
set_time_limit(0);
$ftp_user_name = '*';
$ftp_user_pass = '*';
$ftp_server = '*';
$conn_id=ftp_connect($ftp_server);
$login_result=ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
if(!$login_result) echo 'No connected.<hr><br>';
ftp_pasv($conn, true);
$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);
}