File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes Remote File Operations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Remote File Operations" Watch "Remote File Operations" New topic
Author

Remote File Operations

Joseph M Joy
Greenhorn

Joined: Mar 16, 2011
Posts: 7

Hi,
I've serched a lot for this operation, couldnt get hold of anything great.
My requirement is that, I would like to connect to a remote machine by passing its Hostname, UserID, Password to the program.
Once it is connected, it should be able to perform file operations like read, write, copy, etc.

When serached for the articles in Google, all I could find was fetching the data from ftp URL, accessing the file using JCIFS libraries if the same are in samba shares.
In my scenario, the files just belong to remote machine and also not shared.
Your assistance will be highly appreciated.


Joseph M. Joy
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3595
    
  14

If the files are not shared, the only way to get them is through an application running on the remote machine, like an FTP server. You could even write the server yourself, with your own protocol. Just make sure to use proper encryption like Transport Layer Security.
Joseph M Joy
Greenhorn

Joined: Mar 16, 2011
Posts: 7

@Stephan
Thanks for the response...!!!
However I am working from within a network wherein we cannot start the FTP servcies on certain servers.
Hence, can you suggest any other alternatives than accessing it through FTP?
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3595
    
  14

Like I said, you can write your own server using a custom protocol (not necessarily FTP). This can be pretty simple, just make sure you don't compromise sensitive user data.
Joseph M Joy
Greenhorn

Joined: Mar 16, 2011
Posts: 7

Stephan van Hulst wrote:Like I said, you can write your own server using a custom protocol (not necessarily FTP). This can be pretty simple, just make sure you don't compromise sensitive user data.


Stephan,
Can you provide a sample code for the custom protocol that you have stated.
James Sabre
Ranch Hand

Joined: Sep 07, 2004
Posts: 781

Joseph M Joy wrote:
However I am working from within a network wherein we cannot start the FTP servcies on certain servers.


This would imply that you are not allowed to start any server on these servers so there is no point in writing your own server.

Can you open an ssh session to these servers?


Retired horse trader.
 Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
Joseph M Joy
Greenhorn

Joined: Mar 16, 2011
Posts: 7

James Sabre wrote:
Can you open an ssh session to these servers?


Yes. I can.
However I suppose that ssh can be done only to a linux machine. Please advise if otherwise.
Also, please help me if you have some logic for the same.

I've presently figured out the logic to run shell scripts using ganymed-ssh2 by which I can read and manipulate data in a remote linux machine.
However the same couldn't be used for a windows machine.
James Sabre
Ranch Hand

Joined: Sep 07, 2004
Posts: 781

Joseph M Joy wrote:
James Sabre wrote:
Can you open an ssh session to these servers?


Yes. I can.
However I suppose that ssh can be done only to a linux machine. Please advise if otherwise.


The operating system is not really a factor. There are ssh servers for pretty much all OS but, of course, to be usable to use an ssh server it must be installed.


Also, please help me if you have some logic for the same.
[/code]

Sorry I don't understand.

[code]
I've presently figured out the logic to run shell scripts using ganymed-ssh2 by which I can read and manipulate data in a remote linux machine.
However the same couldn't be used for a windows machine.


You don't say what sort of manipulation is required but as long as it is not complicated then I'm sure equivalent 'scripts' can be run on Windows.
Joseph M Joy
Greenhorn

Joined: Mar 16, 2011
Posts: 7

James Sabre wrote:
You don't say what sort of manipulation is required but as long as it is not complicated then I'm sure equivalent 'scripts' can be run on Windows.

Yes. I can use PSExec for windows and can run the DOS commands on a remote machine from Java.
However, I was thinking that as a non-standard practice.

Hence thought of asking advise.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Remote File Operations
 
Similar Threads
Web Service deployed on JBOSS is not accessible
Debugging on Remote Machine
NX: Core distributed computing concept and locking
like version control
Version COntrol application .