• Post Reply Bookmark Topic Watch Topic
  • New Topic

Copy contents from One location in TeamSite to other location  RSS feed

 
saurabh ashokudgir
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have to copy contents of some files from one location in TeamSite to other location through JAVA. I have written the following code
String command = "cp"+" "+copyFromPath+" "+copyToPath;
Process child = Runtime.getRuntime().exec(command);

There are no exceptions thrown. But the contents are not copied at the mentioned location at the TeamSite.
In the same class I am creating a DCR in Teamsite which is happening correctly.
Kindly help me get through this....
Can we execute commands like telnet and entering our credentials at the server through telnet through JAVA...

Thanks in advance!

Saurabh
 
Rob Spoor
Sheriff
Posts: 20903
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are quite some telnet libraries available; check Apache Commons Net for one.

However, let's investigate the file copy. What are copyFromPath and copyToPath? Are these files local or located on a Windows share? If so, and the user the Java program is executed under, you can just use regular file copying:

You can also try out using FileChannels, but let's start with the basics.
 
saurabh ashokudgir
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your inputs Rob,
Both the CopyFromPath and CopyToPath are the locations in TeamSite and are not local. When I execute the unix command the contents are copied in Teamsite but when I execute the same command through my Java program, it fails in migration. For your reference the copyfrompath is
/default/main/sps/documentation/WORKAREA/workarea/microcontrollers/doc/train_ref_material/HCS12TR.htm

and the copytopath is
/default/main/sps/training/WORKAREA/workarea/files/TRM_HCS12TR.htm
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!