Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Automating FTP download process

Posted on 2011-09-27
4
Medium Priority
?
546 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 498 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 501 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 501 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Ever wonder what it's like to get hit by ransomware? "Tom" gives you all the dirty details first-hand – and conveys the hard lessons his company learned in the aftermath.
A bad practice commonly found during an account life cycle is to set its password to an initial, insecure password. The Password Reset Tool was developed to make the password reset process easier and more secure.
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…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…

721 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