I would like to delete in a FTP folder (and subfolders) all files that contain "2019" string in the name
For example 201902_QSA4_CA.pdf => This file will be deleted
Here my code, but not run:
$web = 'mipage.com';
$user = 'xxxx';
$pass = 'xxxx';
//connect
$conn_id = ftp_connect($web);
$login_result = ftp_login($conn_id,$user,$pass);
$it = new RecursiveDirectoryIterator("pdfs/archivo/");
$display = Array ('2019');
foreach(new RecursiveIteratorIterator($it) as $file)
{
if (in_array(reset(explode('.', $file)), $display))
unlink($file);
}
ftp_close($conn_id);
Someone can help me?
Thxs
Regards