Solved

FTP script to automatically download files

Posted on 2007-12-01
8
1,611 Views
Last Modified: 2013-12-02
Hi there

I have created an FTP site on a server, ftp://server.domain.com

This site will be used by a test group of clients to download their Anti-virus DAT files, rather than connecting to the internet all the time.

However, I would like a way for my FTP site to automatically download these files from the vendor's FTP daily, rather than this being a manual process.

Does anyone know how I can go about doing this? I was thinking of some sort of script/ batch file.

Many thanks!
0
Comment
Question by:kam_uk
  • 4
  • 4
8 Comments
 
LVL 30

Expert Comment

by:SteveGTR
ID: 20387996
Take a look at http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Server/Remote_Desktop-Terminal_Services/Q_22940155.html?sfQueryTermInfo=1+autom+do+download+ftp

The comment by broeckske outlines this process. Post back if you need any additional help.
0
 
LVL 3

Author Comment

by:kam_uk
ID: 20388106
Thanks Steve for the quick answer.

Sorry, I am not much of a script man - so apologies if I am stating the obvious here, but just to confirm -

Say if the files I wanted to download were at

ftp://ftp.mcafee.com/pub/datfiles/english/dat.zip

and I wanted to download them to C:\McAfee downloads on my local machine, then the script would be:

---begin file ftp.txt ---

USER anonymous
cd pub/datfiles/english/
dat.zip
prompt n
mget *.*

--end file ftp.txt ---

with the second script being

---begin ftpdownload.bat ----
@echo off

cd c:\McAfee downloads

ftp -s:ftp.txt ftp.mcafee.com


--- end ftpdownload.bat ----

Thanks again dude.

Cheers
0
 
LVL 30

Accepted Solution

by:
SteveGTR earned 500 total points
ID: 20388320
That looks almost correct. Here's a all in one file that should do the trick:
@echo off
 

setlocal
 

pushd "c:\McAfee downloads"
 

(echo USER)>_temp.txt

(echo anonymous)>>_temp.txt

(echo cd pub/datfiles/english)>>_temp.txt

(echo binary)>>_temp.txt

(echo prompt n)>>_temp.txt

(echo mget *.*)>>_temp.txt
 

ftp -s:_temp.txt ftp.mcafee.com
 

del _temp.txt
 

popd

Open in new window

0
 
LVL 3

Author Comment

by:kam_uk
ID: 20388328
Thanks!

Out of interest, what does the temp.txt file do?
0
Give your grad a cloud of their own!

With up to 8TB of storage, give your favorite graduate their own personal cloud to centralize all their photos, videos and music in one safe place. They can save, sync and share all their stuff, and automatic photo backup helps free up space on their smartphone and tablet.

 
LVL 30

Expert Comment

by:SteveGTR
ID: 20388343
Standard FTP file:

username
password

The change directory command on the FTP server

Setting of binary mode for well binary information :)

I guess the prompt n suppresses prompts for automation purposes.

Finally, the mget *.* gets all files in the directory we changed to on the server.
0
 
LVL 3

Author Comment

by:kam_uk
ID: 20388362
and your 18 lines above replaces both files and should be set as a .bat file, or do I still need the ftp.txt (or temp.txt as you call it) file?
0
 
LVL 30

Expert Comment

by:SteveGTR
ID: 20388367
One file, no need for a supplemental file as _temp.txt is dynamically created and then destroyed.
0
 
LVL 3

Author Comment

by:kam_uk
ID: 20388371
Excellent - many thanks mate!!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Removing first 4 characters from date field in csv file 7 32
server plus 2 84
fiber and Gig ports on 3650 5 39
Need to overwrite data when copy job is run 4 25
Please see preceding article here: http://www.experts-exchange.com/Networking/Operating_Systems/A_11209-Root-Bridge-Election.html Figure 1 After Root Bridge has been elected, then what?..... Let's start by defining a Root Port in la…
SSL is a very common protocol used these days when browsing the web.  The purpose is to provide security to communication, but how does it do it?  There are several pieces at work that have to be setup before SSL will even work and it requires both …
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…

910 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

19 Experts available now in Live!

Get 1:1 Help Now