Author Posts

August 12, 2016 at 10:04 am

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.

August 12, 2016 at 11:15 am

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

August 12, 2016 at 11:43 am

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 🙁

August 12, 2016 at 11:57 am

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

August 12, 2016 at 12:02 pm

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 🙁

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 🙂

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

I need an FTP to FTP solution 🙂

Thanks again