help with FTP?

Associate
Joined
8 Mar 2007
Posts
2,176
Location
between here and there
hey all,

I got me a new website that creates and stores some files. I'm trying to write a very small ftp script to automatly download it for me, but I'm having some issues..

this is what I've got...


ftp.bat

Code:
@echo off
ftp -s:ftpscript.txt ftp.myhost.com
exit


ftpscript.txt

Code:
cd data
mget *.*
bye


but if I run the batch file, it hangs. I've removed the @Echo to de-bug but it just seems to run, "ftp -s:ftpscript.txt ftp.myhost.com" over and over again.

any ideas why??
 
well for now, I'll just use the anonymous account. I know that I can't make changes like this, but I want to get the process right first. (that and the guy who is hosting the site is out today..)

If I could just get it to prompt me for the user, after connecting to ftp.myhost.com, I can work the rest out.

Cheers for the quick reply!! :)
 
Cheers Bledd,

That's the site I've been looking at for the last 2 hours!! ;)

I only entend to download a few txt files so I added "ascii" instead.

Sadly I'm still not connecting to the server in the first place. Everything runs fine if i type it in at the command prompt. "ftp ftp.myhost.com" but if i run "ftp ftp.myhost.com" from a batch file it just hangs.

:(
 
-a gets you in as anonymous for testing, is it not prompting you for a login at all?
Like bledd recommended, this site is similar http://www.robvanderwoude.com/ftp.html
are you using a local server or anything to do this or is it on t'internet? need it testing externally?

-a ?? where would I put that in my syantax??

this is a site that is under construction and hosted on the wibbly wobbly web, so no local access.

But no, I'm not being prompted for a login at all. Am I right in thinking that a batch file containing just "ftp ftp.myhost.com" would open a prompt, show that it's connected and ask me for a user name??

Cheers again guys
 
nope,

If i run it with echo off, I just get a blank prompt window. and if i run it from a command prompt it just hangs with a flashing curser..

Grrrrrr....

;)
 
Last edited:
arh, hang on.

If i run "ftp -a ftp.myhost.com" from the command prompt it works ok. although I still have to press enter to log in as anonymous

EDIT;

It almost seems like it doesn't like the FTP command in a bacth file??!!??
 
Last edited:
HI
I do the same thing but use WGET with the following code in my batch file:

Code:
wget -r -a log.txt -N ftp://USERNAME:[email protected]/
for /f "tokens=1-3 delims=/ " %%d in ("%date%") do rename "log.txt" Log_%%d%%e%%f.txt

This downloads only the amended changes once the site has been initially downloaded, plus creates a logfile (log.txt) which is then renamed to include the date.

Give that a go!

Rob
 
No extra spaces anywhere and both txt and .bat are both located together yea?

no. I've ditched the ftpscript.txt file for now. I just want to get a connection via a batch file, and build from there.

my batch looks like

Code:
@echo off

FTP ftp.myhost.com

exit

but this just hangs with a blank window.

As for the Wget, isn't that a unix command??
 
Not sure why it hangs. I tried mine on a non existant ftp site and it just fails to connect and then is using the ftp command.

Have you tried it without removing the echo? maybe its cutting out some of the output
 
arh,

turns out I had called my batch file "ftp.bat" and then when it ran the first line was "ftp ......" and so it was calling itself and got stuck in a loop!!!

Slap's hand to forehead!!!!!

Cheers for all the input guys!!!

:)
 
I think you had been running the Batch file and the FTP command file from the same directory?Rob

That's exactly what I've been doing, I've just renamed my batch file to something different, and jimmy's your mother's brother!!!

Cheers again
 
Back
Top Bottom