my dog learned polymorphism*
The moose likes Web Services and the fly likes Transfer file onto a remote server  using FTP and SFTP both. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Transfer file onto a remote server  using FTP and SFTP both." Watch "Transfer file onto a remote server  using FTP and SFTP both." New topic
Author

Transfer file onto a remote server using FTP and SFTP both.

ashish jadhav
Ranch Hand

Joined: Nov 20, 2008
Posts: 62

Hi ,
i want to create java application in which javaclass looks at the value of the ftpProtocol attribute and if it says ftp then the file will be transferred via FTP instead of SFTP.

POSSIBLE SOLUTION:
1) Write code in Java using standard FTP classes provided with JDK 1.5.

2) See if the suppliers of pscp.exe have a similar tool for normal FTP and use that.
Possibly use of http://www.ncftp.com/ncftp/doc/ncftpput.html which appears to allow transfer using command line only without needing to create control files.

Can you please advise me easiest possible solution??
or if you have any idea about this type of java application please help me.

Thanking you,
Ashish
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

What does this have to do with web services ?

Are you confusing FTP and FTPS ? SFTP has to do with SSH. Quoting the wikipedia entry just in case


SFTP is not FTP run over SSH, but rather a new protocol designed from the ground up by the IETF SECSH working group


Your requirements are vague and a little confusing. Please elaborate a little more on what you want to achieve


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
ashish jadhav
Ranch Hand

Joined: Nov 20, 2008
Posts: 62
I want to create java class that class must continue to support SFTP and also FTP while transfering file.(file e.g. pdf format, xml format).
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Take a look at the FTPClient class in the Apache Commons Net project/library:
http://commons.apache.org/net/api/org/apache/commons/net/ftp/FTPClient.html
It solves at least the FTP part of your requirements.
Best wishes!
ashish jadhav
Ranch Hand

Joined: Nov 20, 2008
Posts: 62
Thanks Ivan.
I will try and let you know soon..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Transfer file onto a remote server using FTP and SFTP both.
 
Similar Threads
How to achieve secured data transfer through FTPS/SFTP
sftp & scp2
How do I read a file saved on a SFTP server using jScape's SFTP Api
sftp
Implementing SSH for file upload