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

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1647
  • Last Modified:

FTP script to automatically download files

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
kam_uk
Asked:
kam_uk
  • 4
  • 4
1 Solution
 
SteveGTRCommented:
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
 
kam_ukAuthor Commented:
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
 
SteveGTRCommented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
kam_ukAuthor Commented:
Thanks!

Out of interest, what does the temp.txt file do?
0
 
SteveGTRCommented:
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
 
kam_ukAuthor Commented:
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
 
SteveGTRCommented:
One file, no need for a supplemental file as _temp.txt is dynamically created and then destroyed.
0
 
kam_ukAuthor Commented:
Excellent - many thanks mate!!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now