Reputation: 12897
I want to copy one file from system1 to system2. both these system are in the same network. the file is present in a shared folder in system1. i have a username and password to access that location. how can i write a javacode to perform this?
Upvotes: 0
Views: 2759
Reputation: 3284
using sockets. connect to system1. copy file, connect to system 2. paste file. voila.
Upvotes: 0
Reputation: 47183
Does your solution have to use plain Java? If not, it would be better to use existing file transfer utilities, like scp
if you're using *nix computers.
If the answer to my question is yes, then sockets are the way to go. Apache Commons libraries like net and io might also be useful.
Upvotes: 1
Reputation: 1016
I know how to do it under *nix only. First you have to mount both shared folders. That should do either system administrator of your computer or you can do it in your program via FUSE ("File system in user space") and appropriate Samba plugins. And then you can copy required files as usual.
Upvotes: 0