EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Quirk with SBSimpleSftp.TElSimpleSFTPClient.Uploadfiles

Also by EldoS: Solid File System
A virtual file system that offers a feature-rich storage for application documents and data with built-in compression and encryption.
#1954
Posted: 01/02/2007 12:12:41
by Gary Loftus (Basic support level)
Joined: 12/19/2006
Posts: 19

Hi,

I am using the following command to upload all text files from a local directory to an sftp directory:-

sftpClient.UploadFiles("C:\FTPTest", "*.txt", ".", TSBSFTPFileTransferMode.ftmOverwrite, False, TSBSFTPCaseConversion.sccNone, False)

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.

Does anyone have a solution to this?
#1955
Posted: 01/02/2007 12:33:17
by Eugene Mayevski (EldoS Corp.)

0) SFTP doesn't have a concept of current directory. Don't use '.' as a directory name.

If after fixing the above problem the problem continues, please answer ALL of the questions below.

1) what version of SecureBlackbox are you using? Is it SBB 4 or SBB 5?
2) What exactly SSH server software runs on the remote server?
3) how exactly are you looking at the remote file names?


Sincerely yours
Eugene Mayevski
#1956
Posted: 01/03/2007 04:57:10
by Gary Loftus (Basic support level)
Joined: 12/19/2006
Posts: 19

Thanks for the reply Eugene.

I am a bit confused. For the Downloadfiles method I do use "." for the remotepath and it works perfectly.

If I cannot use "." as remotepath what am i supposed to use if I want to access the root directory as "" does not work?
#1958
Posted: 01/03/2007 05:26:01
by Eugene Mayevski (EldoS Corp.)

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.


Sincerely yours
Eugene Mayevski
#1959
Posted: 01/03/2007 06:02:46
by Gary Loftus (Basic support level)
Joined: 12/19/2006
Posts: 19

Thanks again Eugene.

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.
#1960
Posted: 01/03/2007 06:27:49
by Eugene Mayevski (EldoS Corp.)

So what path are you currently using in your requests?

Regarding the downloading -- the backslash is a forbidden symbol in Windows file systems, so it won't appear in the file names after downloading.



Sincerely yours
Eugene Mayevski
#1961
Posted: 01/03/2007 06:30:37
by Gary Loftus (Basic support level)
Joined: 12/19/2006
Posts: 19

Currently I am using this:-

sftpClient.UploadFiles("C:\FTPSTest", "*.txt", "Test", TSBSFTPFileTransferMode.ftmOverwrite, False, TSBSFTPCaseConversion.sccNone, False)

"Test" is a sub-folder on the remote server.

#1962
Posted: 01/03/2007 06:36:04
by Gary Loftus (Basic support level)
Joined: 12/19/2006
Posts: 19

In answer to question 2 the software on the remote server is OpenSSH and the installed version is
openssh-server-3.9p1-8.RHEL4.9 (It's a RedHat Linux RPM).

#1963
Posted: 01/03/2007 07:09:17
by Eugene Mayevski (EldoS Corp.)

Test is still a relative path. YOU MUST USE ABSOLUTE PATHS.


Sincerely yours
Eugene Mayevski
#1964
Posted: 01/03/2007 07:29:54
by Gary Loftus (Basic support level)
Joined: 12/19/2006
Posts: 19

I have changed the code with no effect. I am still having "\" placed in front of the filename.

Dim sRemotePath As String

sRemotePath = sftpClient.RequestAbsolutePath(".")
sftpClient.UploadFiles("C:\FTPSTest", "*.txt", sRemotePath, TSBSFTPFileTransferMode.ftmOverwrite, False, TSBSFTPCaseConversion.sccNone, False)
Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages

Reply

Statistics

Topic viewed 10510 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!