Solved

transfer files using FTP

Posted on 2006-11-06
11
252 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
  • 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
 
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now