DOS FTP Client

K

Keith

Sorry if this isn't the right place to ask this question.

The DOS FTP Client that comes with XP - is it possible to script it so that
I can create a batch file to connect to a site, download certain files and
then disconnect?

Thanks
 
D

David Candy

Read it's help (in Help and Support). It's not a Dos program but a command line windows program.
 
C

Code-Curious Mom

Yeah, try something like:

@echo off
ftp -i -s:"(path)\goftp.bat"


and in goftp.bat put your ftp commands:

open (your ftp site)
(username)
(password)
(do your downloading here)
disconnect
bye

You'll find info in 'Command-line Reference A-Z', if you've found that. Or
type

ftp -?

at command prompt.

Read it's help (in Help and Support). It's not a Dos program but a command
line windows program.
 
K

Keith

Thanks

How can I get files using * or ?

I tried using * as part of teh remote filename but it didn't like it.

I won't always know the filename I will be getting.

Thanks
 
K

Keith

Yes and no

When I script it in a batch file, it seems to be waiting for a prompt on
each file it finde on the remote server that matches my wildcard.
 
R

Rob Schneider

I didn't test this in a bat, but does issuing the ftp command: prompt
change this behaviour?

Suggest you read up on the FTP command. Read about it in "help".

Hope this is useful to you. Let us know.

rms
 
K

Keith

It does work fine when manually issuing the commands to ftp.

However, after it finds each file matching my wildcard (on this occasion
*.log) I have to press Y <enter> before it will process it.

I don't know how to script this (if it's even possible) and the help is no
help.

Thanks
 
R

Rob Schneider

Humm. Maybe time to abandon using this simple little ftp program ... I
guess what might be interesting for you would be to use a more
sophisticated scripting infrastructure, like Perl or Python, to do this.
They both have libraries with ftp capabilities. Both are free.

Hope this is useful to you. Let us know.

rms
 
K

Keith

Thanks for your help

I am going to see what shareware there is out there to do this task.
 
R

Rob Schneider

three or four lines of Python will do it.

Hope this is useful to you. Let us know.

rms
 
C

Code-Curious Mom

According to the help,

-i
Disables interactive prompting during multiple file transfers.

Thus the
ftp -i -s:"(path)\goftp.bat"

You need 2 batch files, the first containing the above line and the
goftp.bat referenced in it. I use this to upload *.htm and it works fine
here.
 
R

Rob Schneider

Excellent. Much better approach to solving the problem than moving to
Python just for this ... Again, reading Help fixes the issue ...

Hope this is useful to you. Let us know.

rms
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top