Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Automating FTP download process

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

 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

Question has a verified solution.

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

The article covers five tools all IT professionals should know about, as they up productivity by a great deal!
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

824 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