EldoS | Feel safer!

Software components for data protection, secure storage and transfer

DirectoryListbox with SFTPClient.ListDirectory

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.
#15082
Posted: 11/17/2010 14:49:26
by Doug Haskins (Basic support level)
Joined: 02/11/2010
Posts: 1

I am working on an inhouse SFTP program. It is using Delphi's DirectoryListbox to display the local file directory, and i'm trying to use the same component to display the remote file directory.

Using SFTPCLient i can connect to the site and collect the directory listing into a TList using OpenDirectory and ListDirectory, but not sure how to get that info into DirectoryListbox, or if there is a better way to do this?

Anyone have an idea on how to link these two components up, or if you have created an SFTP program, how did you display the remote directory listing?

Thanks.

Here is my code so far. It displays the remote directory contents into a memo;

//Set the LocalDirectoryListbox to the local directory
ForceDirectories('c:\SDXSCommandCenterTemp\SFTPFiles\'+ConnectionCombobox.Text);
LocalDirectoryListbox.Directory := 'c:\SDXSCommandCenterTemp\SFTPFiles\'+ConnectionCombobox.Text;

//Get the current directory from the site
dirList := TList.Create;

SftpClient.OpenDirectory(directoryname);
SftpClient.ListDirectory(directoryname, dirList);

for cnt := 0 to dirList.Count - 1 do
begin
SFTPConnectionMemo.Lines.Add(ElSftpFileInfo(DirList[cnt]).Name);
end;
dirList.Free;
#15085
Posted: 11/17/2010 23:51:26
by Vsevolod Ievgiienko (EldoS Corp.)

Thank you for contacting us.

You should better use TTreeView component to display remote directory contents.

Code
var
  tn : TTreeNode;
  ...
begin
    tn := TreeView1.Items.Add(nil, 'Root');

    for cnt := 0 to dirList.Count - 1 do
    begin
      TreeView1.Items.AddChild(tn, ElSftpFileInfo(DirList[cnt]).Name);
    end;
end;

Reply

Statistics

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