EldoS | Feel safer!

Software components for data protection, secure storage and transfer

ReadDirectory under Delphi

Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.
Posted: 09/01/2007 04:20:09
by Thomas Hartmann (Basic support level)
Joined: 09/01/2007
Posts: 1

Does anyone have an example of implementation of ReadDirectory() under Delphi / Pascal

I tried to read the filenames from a server with, OpenDirectory ==> ReadDirectory, but I am not able to read the Filenames with ElSftpFileInfo.Name.
Posted: 09/01/2007 04:29:02
by Santiago CastaƱo (Standard support level)
Joined: 04/16/2006
Posts: 155

You can look at SimpleSFTP Sample (you simply need to feed it a TList object that will hold TElSftpFileInfo objects)

    dirHandle := SftpClient.OpenDirectory(StrFromANSI(FCurrentDir));
    dirList := TList.Create;
      SftpClient.ReadDirectory(dirHandle, dirList);

      for I := 0 to dirList.Count - 1 do
        TElSftpFileInfo(dirList.Items[I]).Name := StrToANSI(TElSftpFileInfo(dirList.Items[I]).Name);
        TElSftpFileInfo(dirList.Items[I]).LongName := StrToANSI(TElSftpFileInfo(dirList.Items[I]).LongName);

      for I := 0 to dirList.Count - 1 do
//you have the names in TElSftpFileInfo(dirList.Items[I]).Name
        // the returned ElSftpFileInfo object must be freed by the application



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