Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1090237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:20:43+00:00 2026-05-16T23:20:43+00:00

Using the library to connect to a remote server and copy a file. I

  • 0

Using the library to connect to a remote server and copy a file. I have the process working fairly well but have some smaller things which I cant seem to resolve as documentation for the library is fairly thin.

I have two routines working. One using the Tamir.SharpSsh class and the other using the Tamir.SharpSsh.jsch class.

  1. Using the Tamir.SharpSsh class I am able to copy the file from the local server to the remote server and tap into the pogress event. What I can’t do is determine if a particular file on the remote server say /Report/data.txt exists on the server. I need to take different actions if it exists or if doesn’t exist. Also how would I rename a file on the remote server. Ive tried using SshExec with a ‘rename’, ‘rn’, and ‘mv’ command and it doesn’t seem to work.

  2. Using the Tamir.SharpSsh.jsch I can copy the file from the local server to the remote server. I can also rename the file on the remote server. What I cant do with this class is to tap into the progress event to keep track of the copy progress. Also I cant seem to find a good way to test to see if a particular file exists on the server. What I have come up with is crude and the only way that I could come up with to test and that is to use

        Dim c As ChannelSftp
        Dim vct As Tamir.SharpSsh.java.util.Vector = c.ls(sRemoteFile)
        Dim cnt As Integer = vct.Count
    

When one or more file exists I get a count no problem. When there is no file then an exception is thrown.

Anyway, I have the routines working its just some minor things I need help with.

tia
AGP

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:20:44+00:00Added an answer on May 16, 2026 at 11:20 pm

    You can call the Tamir.SharpSsh.Sftp.GetFile method using the path of the file you want to check exists (example in C#, sorry):

    private bool FileExists(string filePath)
    {
        try
        {
            SftpConnection connection = new SftpConnection(_host, _username, _password);
            connection.Connect(_port);
            connection.Get(filePath, _toDir);
        }
        catch(JSchException)
        {
            return false;
        }
        return true;
    }
    

    I have also noticed a few other issues through my use of this library – like a lack of a GetFileInfo method or recursive Gets and Puts. But overall it get the job done.

    The simple fact is, Tamir.SharpSsh can’t rename a file remotely – it just does not implement that functionality. You can purchase a better library that has far more features, such as:

    • Kellerman Software .NET SFTP Library
    • wodSFTP.NET
    • Rebex SFTP for .NET
    • edtFTPnet/PRO

    or you could extend SharpSsh, since it is open source.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using some third party library to connect to a server via async
I'm using Pantheios library for logging. I have: pantheios::log(pantheios::debug, I'm debug); pantheios::log(pantheios::informational, Some info);
I am using a jsch library to connect to a server using ssh connection.
Scenario: I have been using Java SE for quite some time, working with threads
I am using ganymed SSH2 java library to connect to a server using public
I'm using R with RMySQL library to connect to Mysql database. I have seen
I'm currently using JSch as the library for connecting to my remote server. In
I have been using a GUI library that allows you to connect signals to
I have WCF library that I hosted , the login function work well, but
I have a SQL Server table that contains some datetime data. I'm using a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.