Downloading files from an external FTP server.

I need to write a script to download spefic file(s) daily from an ftp server to a local directory. The names of these file will change daily (but adhere to a basic naming convention), so the script will need to be flexible enough to look for subsections of the file name string in order to make the determination of which files to download (more than likely with wild card’s).

I’ve been able to find a number of examples on various support forums, but most are for only one file and are hardcoded for a specific name.

Can anyone advise or point me in the direction of an article/link that might help with this?

Can you give examples of the file name(s) you want to download, and how they change from day to day?

The naming convention of the files I need to pull from the ftp server is as follows

L6XQ(Month)(Day)

So in this Format

L6XQ0117

I no longer need to change the names after they arrive in the local directory.

So far I have the following.

$MyCredential = Import-Clixml -Path “C:\Cred\PW1”
$LocalDirectory = "C:\PF_FTP\Received"
$PFFTP = “ftp//10.15.20.25/OutFiles\L6XQ*.*.txt”
$WebClient = New-Object System.Net.WebClient
$URI = New-Object System.Uri ($PFFTP)
$WebClient.DownloadFile ($URI, $LocalDirectoryTemp)

Can you advise if L6XQ*.*.txt would identify the files I need.