Solved

Automating FTP download process

Posted on 2011-09-27
4
527 Views
Last Modified: 2012-05-12
We are using a web-based software that generates reports and posts them to private FTP site.  I would like to write a script to run several times a day automatically that would log into the FTP site, download the most recent file to a folder on our network, and finally delete he file from the FTP site.

Any suggestions?
0
Comment
Question by:mvanderlaan
4 Comments
 
LVL 39

Assisted Solution

by:noci
noci earned 166 total points
Comment Utility
please lookinto curl (http://curl.haxx.se/ )

Do keep in mind that FTP sends passwords unencrypted ...
Maybe scp is a better option (part of the ssh kit).
0
 
LVL 13

Accepted Solution

by:
khairil earned 167 total points
Comment Utility
Hi,

You can use WinSCP with scheduled task, this an example on how go create WinSCP script, you then can create Windows task to call the winscp.exe with given parameter and set the time of execution,

http://winscp.net/eng/docs/scripting#running_a_script_under_a_different_account_e.g._using_a_scheduler
0
 
LVL 16

Assisted Solution

by:AlexPace
AlexPace earned 167 total points
Comment Utility
Below is a Robo-FTP script you can modify to do the job.  Just save the script below in a file named download.s and change the destination folder in the first line and the login information on the second line and you are good to go:
:top
WORKINGDIR "c:\local\destination\folder"
FTPLOGON "ftp.mydomain.com" /user="userID" /pw="secret" 
GETSITEFILE "*" /newest
IFERROR GOTO done
RCVFILE %sitefile /delete
:done
FTPLOGOFF
CRON "@everyhalfhour"
GOTO top

Open in new window


Once you verify that it is able to log in and fetch the newest file, look in the Robo-FTP folder in the start menu and run the Service Installer program.  Just accept the defaults except choose the download.s file as your comand script and click the Install button.  You now have a Windows Service that downloads and deletes the newest file from this FTP site every half hour.  If that is too often you can change the CRON line near the botton to @hourly or @every2hours or @every4hours or @every6hours etc...  The beauty of doing this as a Windows Service is that it will automatically restart if the computer is rebooted.
0
 

Author Closing Comment

by:mvanderlaan
Comment Utility
This was the best solution for me since I am already familiar with WinSCP and is easy to setup.
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
This article explains in simple steps how to renew expiring Exchange Server Internal Transport Certificate.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now