Link to home
Create AccountLog in
Avatar of Star Gazr1
Star Gazr1Flag for United States of America

asked on

FTP with Batch File

From a Windows XP computer, I am looking to create a batch file to automate an FTP Login and FTP copy of multiple files at one time up to an FTP Server.
I had posted this issue before a while back but didn't get around to testing the solutions offered.
Below is the link to one of the solutions offered.   I tried the open command and got an error.  The other option uses a .scr file along with the FTP -S and FTP -N
Any ideas on how I an acomplish all within the .bat file and not have to call a .scr file?     Thanks.

http://support.microsoft.com/kb/96269

open hostname.com
user
guest
guest


It also talks about ftp -s:test.scr
and using ftp -n option as well.
ASKER CERTIFIED SOLUTION
Avatar of Bradley Fox
Bradley Fox
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Star Gazr1

ASKER

@mcsween thanks for the reply.  
For the ftp -n -s:file.txt where do I specify the hostname of the ftp server ?
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
@jeffld To answer your questions about DNS and Firewall. That is not the issue I can connect fine from a command prompt using FTP IP Address and then typing in the user and password.   I am confused about your parallel transfers .scr reference?  Are you saying I can't do the other method, ftp -n -s:somecommandfile.txt  in Windows?
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
@jeffld the open command doesn't work on my system, I get an error not recognized. I am aware of the help option. thanks.

@mcsween when I tried to follow your steps, I get an error invalid command for the login username, any ideas?
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
@jeffld. I think I am missing something here.
If I type in open ftpserver ip I get an error.
Don't I need to type FTP first?
like
FTP Open ip address ?
If I do this manually and I type FTP, then I get an FTP prompt, then I can type in
Open FTP Server ok.  But I still am lost at how to accomplish this within a Batch File.
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
@dragon-it thanks for the info.  When I tried your method the command prompt pops up and is stuck waiting for an input of the password (like below)

password:
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
I was able to get this done finally with adjusting @mcsween's method (see below for what worked).  Thanks.
FTP Batch File Command: ftp -i -n -s:file.txt FTPServerIP

file.txt file info
username
username
password
cd UploadDirectory
mput *
quit
Yes, some servers work with one, some the other but they all should work with one of them.

Steve