+2 votes
by (140 points)
edited

I am writing a very simple application that is going to download multiple files using SFTP, one at time.

For example, using the code below:

    Dim client As New Sftp
    client.Connect(selected_host)
    client.Login(hostusername, hostpword)
    client.GetFile("/var/log/messages", save_location & "\messages")

WHat I want to do is to get the percentage that has been downloaded an update a label on a windows form, so I can see when it is complete and how far it has progressed.

I have looked at the examples that come with the SFTP module purchase but found them complicated. Could someone show me here some simple sample code that could do this please?

Many thanks in advance,

Paul Davey

UPDATE: I have managed to resolve this myself :) But I do have one related question.

When I get a file using the Get Method, I sometimes get a 0 bytes downloaded file because the account I have connected with doesn't have writes to the file on the remote server to download. How can I check if the account I have connected with has permissions to the file?

Applies to: Rebex SFTP
by (13.3k points)
Hello Paul. Nice to know that you solved it! Would it be possible to submit the second question as a separate question via http://forum.rebex.net/questions/ask ? Keeping single question per thread thread would help future readers greatly. Thanks! Martin
by (147k points)
To answer your second question - the GetFile method should throw an exception in the case described. To be able to tell why this didn't happen, please post a communication log (in a separate question as recommended by Martin) showing what happened during the GetFile call. Comment out any hostnames or usernames if appropriate. Please check out http://forum.rebex.net/questions/10/how-to-create-a-log-of-communication-between-component-and-server to see how to create this log.

1 Answer

+1 vote
by (13.3k points)
edited

It looks like you've been faster than others and solved it yourself. For future readers - ResumableTransfer - Resumable Transfer GUI Utility is worth checking. It concentrates on a single task and shows how to safely update Windows Forms UI while running the SFTP transfer in a background thread.

alt text

...