Solved

transfer files using FTP

Posted on 2006-11-06
11
257 Views
Last Modified: 2010-03-31
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
Comment
Question by:jaggernat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 2
11 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 17882141
>>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
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 17882166
You can use jakarta commons-net to do ftp opertions

http://jakarta.apache.org/commons/net
0
 
LVL 10

Author Comment

by:jaggernat
ID: 17882183
yes , i can access directories of Machine B in Machine A (they are in network)
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
LVL 86

Expert Comment

by:CEHJ
ID: 17882224
Just copy them directly then


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

Write in the normal way
0
 
LVL 10

Author Comment

by:jaggernat
ID: 17882261
any idea whats the FTP command to copy the file from Machine A to Machine B ?

thanks
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17882281
put
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17882282
(But as i said, you shouldn't need FTP)
0
 
LVL 23

Assisted Solution

by:Ajay-Singh
Ajay-Singh earned 100 total points
ID: 17882289
> 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
 
LVL 86

Accepted Solution

by:
CEHJ earned 250 total points
ID: 17882334
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
 
LVL 10

Author Comment

by:jaggernat
ID: 17882642
thanks guys, let me see whats the appropriate solution and i'll get right back..
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 18001457
:-)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
maven disable workspace resolution 1 70
Java class and jar 3 58
maven not picking latest jar instead picking old jar from .m2 12 72
Java import explained 4 44
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question