EldoS | Feel safer!

Software components for data protection, secure storage and transfer

SFTP Changing Directory, What's wrong

Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.
Posted: 06/11/2016 19:59:31
by A A (Standard support level)
Joined: 06/11/2016
Posts: 1

I need some help please.

I’m trying to change the directory to /etc/httpd/ but It won’t do it? What wrong with my code?

procedure TfrmMain.ToolButton3Click(Sender: TObject);
  DirHandle: ByteArray;

edit1.Text := '/etc/httpd/';
      on E : Exception do
        Log('Unable to change directory: [' + E.Message + ']', true);
      FCurrentDir := StrToANSI(SftpClient.RequestAbsolutePath(edit1.Text));
      FCurrentDir := '.';

   // Refresh;

Posted: 06/12/2016 13:38:16
by Ken Ivanov (EldoS Corp.)

Thank you for contacting us.

SFTP doesn't have a concept of current directory. You must always use absolute paths when you refer to the files.

You can [carefully] use relative paths too, yet the result will depends on server implementation (in most cases, the path will be relative to user's home page). Use RequestAbsolutePath() method to convert relative paths to absolute ones.

Please see the SFTP samples as to how manage remote directory browsing.




Topic viewed 979 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!