EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Change directory for Write

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.
Posted: 10/15/2007 16:22:08
by Leslie Andrews (Basic support level)
Joined: 10/15/2007
Posts: 2

I searched the forum and found that the OpenDirectory command that I am using is only valid for changing a directory on the server to read. I need to be able to change the directory on the server to WRITE a file in my Delphi 6 program...When I was using the Indy components I could use the ChangeDir command, but I can't seem to find the equivalent in the TElSimpleSFTPClient component. Am I required to use the ElSFTPClient to change to another directory on the server for Writing?

Thank you.

Leslie Andrews

Posted: 10/15/2007 23:53:01
by Eugene Mayevski (EldoS Corp.)

What is "change directory"? If you are talking about FTP's CWD command, then SFTP doesn't have it, as it doesn't have a concept of current directory. Please read the FAQ in SecureBlackbox knowledgebase.

Sincerely yours
Eugene Mayevski
Posted: 10/16/2007 08:11:32
by Leslie Andrews (Basic support level)
Joined: 10/15/2007
Posts: 2

Ok I read the FAQ, how do I set the absolute path?

Currently I am doing this:
procedure TfrmMain.TransferPaymentFile1Click(Sender: TObject);
  strFileName, strTransferID : string;
  intLastTransferID : integer;
  Save_Cursor : TCursor;
  i : integer;
  frmMain.OpenDialog1.InitialDir:= ExtractFilePath(Application.ExeName) + '\FileTransfer';
  if frmMain.OpenDialog1.Execute then
      Save_Cursor := Screen.Cursor;
      Screen.Cursor := crHourGlass;
      if PasswordDlg.ModalResult = mrOk then
        if FTP_SHARE.Active then
              For i := 0 to OpenDialog1.Files.Count - 1 do
                FTP_SHARE.UploadFile(OpenDialog1.Files.Strings[i], ExtractFileName(OpenDialog1.Files.Strings[i]));
              ShowMessage('Files successfully transfered!');
            on E : Exception do
              ShowMessage('Error during upload: ' + E.Message);
      Screen.Cursor := Save_Cursor;  // Always restore to normal

When the user fills in the UserName on the login form, the server sets the path to the username: \AGENCY218

I need to transfer to the path:

Posted: 10/16/2007 10:03:27
by Ken Ivanov (EldoS Corp.)

how do I set the absolute path?

The absolute path cannot be set. The absolute path is just the canonical value of some relative path. E.g., the "./dir1/dir2" path is relative path, and "/home/user1/dir1/dir2" is the corresponding absolute path. RequestAbsolutePath() simply obtains the absolute path for some relative path.

You can use the following algorithm to upload the file to the needed location:
1. As soon as SFTP session is opened, call RequestAbsolutePath(".") to get the absolute path value for the user home directory.

HomePath := Client.RequestAbsolutePath('.');

2. Form the destination path by appending the needed subdirectory name to the obtained home path string.

UploadPlace := HomePath + '/' + 'IN/';



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