Move Files using WildCard (*.sql) from one DIR to another via FTP

I think the title says it in a nutshell.

I need a script to run on a local machine, that will connect to an FTP Server, and move ALL *.SQL files from that DIR to another.

Example: from ROOT to PROCESSING

After research, I think I know what the process is - I just don’t know how to implement it.

So, the script would create a ‘list’ of all the *,SQL files - and then using that list it would either rename/copy them to the new DIR and then delete them from the ROOT?

To give a bit more of an understanding of the problem, individual SQL files are uploaded to ROOT throughout the day - and could be added at any moment - so the script would be ran every 5-10 mins and “move” them to a DIR named PROCESSING.

You don’t really need PowerShell for that. Just use the built-in Windows FTP client with an FTP script and trigger it via a scheduled task. FTP scripts support wildcards too.

http://www.dostips.com/DtTipsFtpBatchScript.php

Thank you for your response. We have tried using .bat scripts and have some triggers using Windows Scheduler with success.

It’s just the moving from one dir to another using only the FTP server (not downloading to local machine) that there appears to be no simple command for.

RNFR and RNTO give me an invalid command response from CMD when connected :frowning:

Have you tried the FTP mput command?

https://technet.microsoft.com/en-us/library/bb490668.aspx

You can also see if you can get the PowerShell script on below site to work for you.

https://gallery.technet.microsoft.com/scriptcenter/80647f66-139c-40a4-bb7a-04a2d73d423c

I believe mput is for transfer between ftp and local machine so wouldn’t solve the problem. It’s crazy that such a seemingly simple thing to do isn’t supported :frowning:

I’ve had success with Robo-FTP - so have a get out of jail free card - just there’s a cost to it so it isn’t free.

I’ll take a look at the powershell link you provided :slight_smile:

Edit - The powershell looks like FTP to Local (or vice versa)

I need an FTP to FTP solution :slight_smile:

Thanks again