Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

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.
aksarben

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/
martin

Re: SFTP Put Command

Sorry, but I'm lost. What does the command-line syntax have to do with WinSCP .NET assembly? Didn't you mean WinSCP scripting?
For scripting, please start here:
https://winscp.net/eng/docs/guide_automation
aksarben

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)?