login about faq

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

asked Sep 16 '14 at 10:45

chilldll's gravatar image

chilldll
3631015

edited Sep 16 '14 at 11:35


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

link

answered Sep 16 '14 at 11:56

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

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

link

answered Sep 16 '14 at 11:57

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Thank you Chilkat, I just noticed this example : http://www.example-code.com/vbdotnet/ssh_exec.asp

(Sep 16 '14 at 12:40) chilldll

That example talks about SSH, Thank you for your help

(Sep 16 '14 at 12:41) chilldll

IMHO, Chilkat sftp transfer or create the file in the root directory. And then we have to implement Chilkat SSH Exec to do file transfer to a specified folder. File Transfer or File write is the Task # 1 using sftp and File Move to a new directory is the Task # 2 using SSH.

(Sep 16 '14 at 13:01) chilldll
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×201
×43

Asked: Sep 16 '14 at 10:45

Seen: 1,296 times

Last updated: Sep 16 '14 at 13:56

powered by OSQA