• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 263
  • Last Modified:

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
0
jaggernat
Asked:
jaggernat
  • 6
  • 3
  • 2
2 Solutions
 
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
 
jaggernatAuthor Commented:
yes , i can access directories of Machine B in Machine A (they are in network)
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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-SinghCommented:
> 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
 
CEHJCommented:
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
 
jaggernatAuthor Commented:
thanks guys, let me see whats the appropriate solution and i'll get right back..
0
 
CEHJCommented:
:-)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 6
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now