• Post Reply Bookmark Topic Watch Topic
  • New Topic

move files from one machine to another  RSS feed

 
Mandy Smith
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a file stored under directory called test on weblogic server. Weblogic is running on sun solaris machine. Now, i want to move this file from this test directory to another machine(totally a different machine to some specified directory) through java code ie., just like the way we scp from one machine to another machine on command prompt but thru java code. Is this possible? If so, please let me know how to do this, i am not too familiar with unix commands. Thanks.
Appreciate your help.
 
Tim Holloway
Bartender
Posts: 18715
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If there's a network share in place - and you have write access to the target, you can just do a simple read/write loop. Basically, like this:

Exact format of the network file name may vary somewhat.
 
Steve Granton
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
This may be off on a tangent but may be useful. I'm fairly sure that you can call Ant (http://jakarta.apache.org/ant/index.html) from within java (since its written in java) and you could have an Ant task that ftps the files to the remote machine - you could also zip the files using Ant if they are large.
Cheers,
Steve
 
Mandy Smith
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Steve. I liked your idea of scheduling the task to Ant. I am fairly new to Ant usage, so could you please post a sample code as to how Ant ftps to the remote machine.
Thanks,
Appreciate u'r help.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!