0

I want ot execute the following commands using batch file:

1.ftp 127.0.0.1 
2.USERNAME
3.PASSWORD 
4.put
5.D:\\zz.xml
6.mmm.xml 

Each command is a sequence of the prev command

I want to move file from local to ftp server
I googled for that and I found that insert ; between commands is the solution but itsn't correct for me

Please support me

1
  • I could not see how the c# tag was relevant; I removed it. If it was relevant, re add it, but explain in the question why this relates to c#. Commented Nov 2, 2010 at 18:23

4 Answers 4

1

1 is a command on the command prompt, but 2..6 are FTP commands.

I would put lines 2..6 in a file called commands.txt then redirect that file to stdin.

ftp 127.0.0.1 < commands.txt

Edit:
You could use -s:commands.txt instead of the < according to the ftp help.

-s:filename Specifies a text file containing FTP commands; the
commands will automatically run after FTP starts.

Sign up to request clarification or add additional context in comments.

1 Comment

what about sequential in FTP commands It means <CRLF> between commands or what ??
0

Use a CRLF between each command.

Comments

0

I would rather use the expect command that allows you to script inputs according to outputs. You can find some information here: http://en.wikipedia.org/wiki/Expect

You have an example on that page that describes exactly what you want to do.

Comments

0

@Albin Sunnanbo

Thanks for your reply

I solved the problem now from the following tutorial http://www.dostips.com/DtTipsFtpBatchScript.php

I write the foillowing commnads in batch file:

FTP -v -i -s:commands.txt

then commands.txt contaisn the following commands

open 127.0.0.1 
UserName
Password
put
D:\\zz.xml
mmm.xml

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.