Link to home
Start Free TrialLog in
Avatar of kam_uk
kam_uk

asked on

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!
Avatar of SteveGTR
SteveGTR
Flag of United States of America image

Take a look at https://www.experts-exchange.com/questions/22940155/Looking-for-a-way-to-automate-FTP-process.html?sfQueryTermInfo=1+autom+do+download+ftp

The comment by broeckske outlines this process. Post back if you need any additional help.
Avatar of kam_uk
kam_uk

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of SteveGTR
SteveGTR
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kam_uk

ASKER

Thanks!

Out of interest, what does the temp.txt file do?
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.
Avatar of kam_uk

ASKER

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?
One file, no need for a supplemental file as _temp.txt is dynamically created and then destroyed.
Avatar of kam_uk

ASKER

Excellent - many thanks mate!!