Link to home
Start Free TrialLog in
Avatar of ricjava
ricjava

asked on

Copy folders from computer A to computer B

I need to write a program to achieve the following task
a) Copy a folder with all the files in it from computer A to computer B
b) Delete the folder from original computer
c) This java program must be able to run in any computers in the LAN.

What classes and methods do I need to achieve the task?
Does anyone has a sample program that copy file from one computer to another?
Please guide me how to do the task. Thanks
Avatar of applekanna
applekanna

Java RMI is the way to go
A simple java RMI file transfer application with source code.

http://developer.java.sun.com/developer/technicalArticles/RMI/rmi_corba/

we can also use sockets as suggested by CEHJ in the thread

https://www.experts-exchange.com/questions/20752924/Copying-a-file-using-sockets.html

>>b) Delete the folder from original computer
just add fileObject.delete() in the programs to delte the files

c) This java program must be able to run in any computers in the LAN.
>> JAVA must be installed on the client computers on the LAN

Hope this helps , Cheers !
Avatar of ricjava

ASKER

Hi expert,

Anymore help....please....why must I use rmi or socket and not the usual file operation?



>>must I use rmi or socket and not the usual file operation

Here we are talking about moving data from 1 copm to another as per your q, this invoices a network and communication of data over n/w so we use RMI or sockets.

I am not sure if we can do otherwise if there is I wold also like to know :)
We can also connect to it  using FTP if you have a ftp server running but again this involves sockets

Does this help?
I will mail you an example.
but don't know your email. mail me if you still want the code.
but don't know your email. mail me[nopadolsiri@hotmail.com] if you still want the code.
Avatar of CEHJ
Please do not mail anything anywhere. This is against the Member Agreement. Post the code here if you've got it.
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry experts. I am new for experts-exchange.
:-)