• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

move files from one machine to another  RSS feed

 
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.
 
Bartender
Posts: 19664
92
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.
 
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!