I work on VB.Net Application which connects Linux server using sftp and write the file in the server's root directory.
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
Absolute paths are absolute to the root of the filesystem, and relative paths are relative to the HOME directory of the SSH user account.
You can also use the RealPath method to see the actual absolute path on the server of what you pass in..