Solved

Automating FTP download process

Posted on 2011-09-27
4
544 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 40

Assisted Solution

by:noci
noci earned 166 total points
ID: 36713578
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
ID: 36714937
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
ID: 36718398
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
ID: 36904534
This was the best solution for me since I am already familiar with WinSCP and is easy to setup.
0

Featured Post

Threat Trends for MSPs to Watch

See the findings.
Despite its humble beginnings, phishing has come a long way since those first crudely constructed emails. Today, phishing sites can appear and disappear in the length of a coffee break, and it takes more than a little know-how to keep your clients secure.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A 2007 NCSA Cyber Security survey revealed that a mere 4% of the population has a full understanding of firewalls. As business owner, you should be part of that 4% that has a full understanding.
This process allows computer passwords to be managed and secured without using LAPS. This is an improvement on an existing process, enhanced to store password encrypted, instead of clear-text files within SQL
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…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Suggested Courses
Course of the Month8 days, 5 hours left to enroll

617 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