SFTP Put Command

Advertisement

aksarben
Joined:
Posts:
72

SFTP Put Command

I have a couple of questions on using the SFTP put command with the .NET assembly:
  1. I found a page at https://tecadmin.net/transferring-files-over-ssh/ which indicates the syntax looks like this:
    scp -r /path/to/local/directory username@remote_host:/path/to/remote/directory
    Does the .NET assembly support this syntax for SFTP? I ask because the example was for scp, not SFTP.

  2. If the put command fails because the remote directory doesn’t exist, will the .NET assembly detect that & automatically create the remote directory? If not, how will the client know that the failure was due to a non-existent directory (so we can create it ourselves)?

Reply with quote

Advertisement

aksarben
Joined:
Posts:
72

Re: SFTP Put Command

I was just using that as an example, since I haven't found any authoritative information online (due to unfinished RFCs).

The basic question is this: When we issue a put command through WinSCP’s .NET assembly, and it fails due to non-existent directory (which happens a lot in our use case, since we create new files/folders every day), will the .NET assembly create the directory re-try the “put” before reporting an error to the caller?

If not, will it report the cause of the error to the caller so we can create the directory ourselves?

Dick Adams
http://www.hymntime.com/tch/

Reply with quote

martin
Site Admin
martin avatar

Re: SFTP Put Command

The target folder is not created in general. If you are not sure, if the target folder exists before the upload, do test its existence using Session.FileExists and create it if it does not.

Reply with quote

Advertisement

You can post new topics in this forum