How do I copy files in a directory with filename contains.. see sample below
file_123_XXXXXX.zip where XXXXXX is a random numbers..
I want to copy file_123_XXXXXX.zip from server to same file name to my local folder
the code is working operational if I set the filename exactly the same in the server but what if the file name randomly changes everyday.
thanks in advance..
here is my code:
include("./config.php");
$local_file1 = 'C:\Destination\file_123_XXXXXX.zip'; //how to copy the original filename XXXXX 
if(file_exists($local_file1))
{
    echo "
                $('#getUpdts').attr('disabled','disabled')
                            .addClass('ui-state-disabled');
                $('#proc').removeAttr('disabled')
                        .removeClass('ui-state-disabled');
    ";
    echo "infoMsg('File is already downloaded..')";
}
else
{
    $ftp_user = ftp_user;
    $ftp_pw = ftp_pw;
    $conn_id = ftp_connect('192.xxx.xxx.xxx') or die("Couldn't connect to 192.xxx.xxx.xxx");    
    $server_file1 = "/fromlocation/file_123_XXXXXX.zip"; //the filename with random that i want to get
    $login_result = ftp_login($conn_id, $ftp_user, $ftp_pw);
    if(!file_exists($local_file1))
    {
        $contents = ftp_size($conn_id, $server_file1);
        if ($contents >0) {
            if (ftp_get($conn_id, $local_file1, $server_file1, FTP_BINARY)) {
                echo "infoMsg('Successfully downloaded');";
            } else {
                echo "alertMsg('Unable to download');";
            }
        }else{
            echo "alertMsg('Does not exist.');";
        }
    }
    else
    {
        echo "alertMsg('does not exists');";
    }
    // close the connection
    ftp_close($conn_id);
}