transfer files using FTP

Dear experts

I have two machines , Machine A and Machine B. From Machine A , I have to transfer a file in a directory  of Machine B.
I am using FTP Server in machine B. Any ideas  how I can do that?

Do i need to use Java or can i use some FTP commands to get the job done?


Thanks
J
LVL 10
jaggernatAsked:
Who is Participating?
 
CEHJConnect With a Mentor Commented:
For simply putting a file you don't need a special API. You can use


       URL ftp = new URL("ftp://username:password@69.194.83.97/asdsa.txt");
       URLConnection conn = ftp.openConnection();
       conn.setDoOutput(true);
       PrintWriter out = new PrintWriter(conn.getOutputStream());
       out.println("How's that");
       out.println("krupini?");
       out.close();
0
 
CEHJCommented:
>>Do i need to use Java or can i use some FTP commands to get the job done?

That depends on a lot of things. Are the machines on the same network? If they are, you don't necessarily need FTP
0
 
Ajay-SinghCommented:
You can use jakarta commons-net to do ftp opertions

http://jakarta.apache.org/commons/net
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
jaggernatAuthor Commented:
yes , i can access directories of Machine B in Machine A (they are in network)
0
 
CEHJCommented:
Just copy them directly then


File remote = new File("\\\\servername\\sharename\\filename");

Write in the normal way
0
 
jaggernatAuthor Commented:
any idea whats the FTP command to copy the file from Machine A to Machine B ?

thanks
0
 
CEHJCommented:
put
0
 
CEHJCommented:
(But as i said, you shouldn't need FTP)
0
 
Ajay-SinghConnect With a Mentor Commented:
> any idea whats the FTP command to copy the file from Machine A t
checkout this: http://wiki.apache.org/jakarta-commons/Net/FrequentlyAskedQuestions
0
 
jaggernatAuthor Commented:
thanks guys, let me see whats the appropriate solution and i'll get right back..
0
 
CEHJCommented:
:-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.