开发者

copy file from unix system to windows using ant

can any one help me

how to copy file from unix Windoes开发者_开发问答 system to windows UNIX using ant?

Thanks in advance

EDIT

Let me explain in detail what I am looking for I want to copy file from windows to unix machine (correcting my previous question not from unix to windows) using ANT. I thought of using ftp task.

Before that as a check I tried to ftp unix sever from windows but it gave connection refused error(Do I need to provide my username and password,if that is the case what is the syntax).

But I am able to connect through putty which asks for my user name and password. Does putty uses a different protocol.

So if that is the case does ftp task works for me in ANT?. If not what task I need to use?


You have a couple of options.

If you have a windows shared drive mounted on your windows you can simply use the task.

<copy>

http://ant.apache.org/manual/Tasks/copy.html

If you don't you'll need to set up some service in the Windows side, probably FTP, if that's the case you'll need to use the task:

<ftp>

http://ant.apache.org/manual/Tasks/ftp.html

EDIT

As per your comment, this is all you need:

http://ant.apache.org/manual/Tasks/ftp.html

Take a look at your server ( UNIX ) FTP configuration, compare it with the one you're using in putty.

The protocol should be the same, but unless you give us your FTP server IP + User/Password we won't be able to test it for you.

The link I posted has the needed configuration and examples on how to connect to an UNIX server using FTP. Just, try it.


Probably the simplest option (if you are going from Windows -> Unix) is the Ant SCP task (which will use the same underlying type of connection PuTTY uses -- SSH). See the Ant SCP Task for details. Note that this will require that you have JSch here.


ant scp task can be set up to use passwordless ssh if you set it up with an appropriate key file.

So first make sure you can ssh to the windos server without putting your password into the shell. here is a good set of tutorial for doing it unix to unix http://rcsg-gsir.imsb-dsgi.nrc-cnrc.gc.ca/documents/internet/node31.html . Haven't tried setting up a windows machine, so not too sure how that would work though.

<scp file="file.zip" dir="${userid}@${server}:${remotedir}" keyfile="${env.HOME}/.ssh/id_rsa" passphrase=""/>  
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜