When I go to look at the files on the SFTP server I'm noticing that they are having a "\" added in front of the names. e.g. "Hello.txt" on my local server is ending up on the remote server as "\Hello.txt". I have tried using the command with and without the final "\". e.g. "c:\FTPTest\" and "C:\FTPTest" but the forward slash keeps on appearing.

You must use absolute paths, such as "/home", or "/root". You can use GetAbsolutePath(".") to request the absolute path for the directory.

The fact that point works for DownloadFiles means only one thing - the server implements file name handling differently for download and for upload.

In any case, the behaviour described in your original question is a server-side problem. ElSimpleSftpClient itself has nothing to do with those paths -- the path you give is only merged with the filename and passed to the server. There's no place for "\" (backslash) to appear. I can share the source code (in pascal) of UploadFiles() method so you can check it yourself.

I created a sub-directory for testing purposes on the remote server called "Test". The filenames still have a "\" in front of them when using the Uploadfiles method call.

In answer to your 3 questions:

1) I am using version 5.0.104
2) I dont know what SSH server software runs on the remote server. I do not have control over it. I am trying to find out now.
3) I am using an application called Sftpdrive to view the files on the remote server. I have also looked at the files with CuteFTP with the same results. Interestingly, when I use the downloadfiles method call to retieve the files, they are not having the "\" on them when copied to my local server.

We use cookies to help provide you with the best possible online experience. By using this site, you agree that we may store and access cookies on your device. You can find out more about and set your own preferences here.