Archived Forum Post

Index of archived forum posts

Question:

Chilkat sftp to mention the destination folder

Sep 16 '14 at 13:56

I work on VB.Net Application which connects Linux server using sftp and write the file in the server's root directory. \home\<user id>

Is it possible to mention which folder we want the file to be written in the Linux Server.

Below method is to write the file in the server by taking Byte Variable as Input.

I have tried by appending the filepath to the variable _fileName

_

fileName = "/home/folder/subfolder/" & "file.csv"

     Dim handle As String
                handle = sftp.OpenFile(_fileName, "writeOnly",

"createTruncate") If (handle = vbNullString) Then MsgBox(sftp.LastErrorText) Exit Function End If

                ' Variable : byte is written as .csv file 
                success = sftp.WriteFileBytes(handle, data)
                If (success <> True) Then
                    MsgBox(sftp.LastErrorText)
                    Exit Function
                End If

Accepted Answer

Absolute paths are absolute to the root of the filesystem, and relative paths are relative to the HOME directory of the SSH user account.


Answer

You can also use the RealPath method to see the actual absolute path on the server of what you pass in..