Solved

Automating FTP download process

Posted on 2011-09-27
4
531 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 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Getting EventID 4625 logon failures 18 103
icacls on files that are maximum 2 days old 2 57
What is a hashed password and/or MD5? 5 60
yahoo Hacks 9 93
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
In 2017, ransomware will become so virulent and widespread that if you aren’t a victim yourself, you will know someone who is.
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 tutorial demonstrates a quick way of adding group price to multiple Magento products.

919 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

24 Experts available now in Live!

Get 1:1 Help Now