Discussion Locked

FTP script

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

on Win2k Pro i download files from a ftp Site every day using command prompt. i want to automate this task. the script should download the files from the given ftp site every day as sceduled. the script should also supply password for the anonynous account as blank ( or whatever the password is).

any solutions ?

3 replies

by joseph moore

Yep, this is easy.
Say your FTP server is FTP.MYDOMAIN.COM and you want to get FILE1.TXT from it and download it to a local directory on your computer (c:\download). Say your username is BOB and the password is "PaSsWoRd".

First, make a TXT filewith the following contents:

open FTP.MYDOMAIN.COM
BOB
PaSsWoRd
binary
lcd c:/download
get FILE1.TXT
quit

Save that TXT file as DOWNLOAD.TXT and say you put it in the C:\WINNT directory.

You could then set up a Scheduled Job that would look as follows:

FTP -s:C:\WINNT\DOWNLOAD.TXT

Have the Scheduled Job run whenever you want.

The key is the -s switch with the FTP command. That says read the input file (in this case, DOWNLOAD.TXT), parse out each line of it and pump the lines into the FTP command shell.

hope this helps

This discussion is closed to new replies.