Retrieve Files from remote server based on yesterday's date
<p>I need to modify this script to retrieve only the files with yesterday's date. Here is what I have:</p>

<pre><code>&lt;?php
$username = 'XXXXXX';
$password = 'XXXXXX';
$ftp_server = 'data.mywebsite.com';

 $conn = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server");
if(ftp_login($conn, $username, $password))
{
    echo 'Logged in';
}
else
{
    echo 'FTP Error:Could not log in to '.$ftp_server;
    exit();
}
ftp_pasv ($conn, true);
if (ftp_chdir($conn, "../Photos/Hi-res")) {
    echo "Current FTP directory is now: " . ftp_pwd($conn) . "\n";
} else { 
    echo "Couldn't change to Photos directory\n";
}

$list = ftp_nlist($conn, '.');
function is_img($file) {
    if(preg_match('/.*\.png/', $file))
    {
        return preg_match('/.*\.png/', $file) &gt; 0;
    }
    if(preg_match('/.*\.jpg/', $file))
    {
        return preg_match('/.*\.jpg/', $file) &gt; 0;
    }
    if(preg_match('/.*\.gif/', $file))
    {
        return preg_match('/.*\.gif/', $file) &gt; 0;
    }
}

$filtered = array_filter($list, is_img);
foreach($filtered as $img) {
    if (ftp_get($conn, $img, $img, FTP_BINARY)) {
        echo "Successfully written to $img\n";
    } else {
        echo "There was a problem\n";
    }
}
ftp_close($conn);
</code></pre>

<p>When I run the script, it is grabbing all files not already on my server which is not what I want. I just want it to grab all the files with yesterdays date.
Thanks</p>
