Synapse read directory structure lazarus / 31-LCL ---------------------------------------------------------------------- Maverich · 2012-07-25 13:52 using the class FtpSend, after conn after the connection to ftp server , how to get the structure of a directory Code: [Select]ListBox1.Items: = Ftp.FtpList.Lines; returns only the names of files in a directory ---------------------------------------------------------------------- KpjComp · 2012-07-25 14:03 Code: [Select]ftp.FtpList.Items[] ---------------------------------------------------------------------- Maverich · 2012-07-26 04:40 Items[Index: integer]:TFtpListRec Code: [Select]ListBox1.Items := FTPS.FtpList.i.Items[0]; unit1.pas(246,42) Error: Incompatible type for arg no. 1: Got "TFTPListRec", expected "TStrings" exist property Masks  ...   ListBox1.Items := Ftps.FtpList.Masks; but not found how to use structure result on Ftp.FtpList.Lines -r-r-r-      1 ftp ftp  109203 jul 24 09:52 ACC_ROUTING -dr-xr-xr-x  2 ftp ftp  1024   jul 24 09:50 Images -r-r-r-      1 ftp ftp  .....  -dr-xr-xr-x  6 ftp ftp  1024   Dec 20 2011  Test1 -dr-xr-xr-x  2 ftp ftp    80   jul  2 08:24 Test2 Code: [Select]  //LbDirectory -> TListBox   if FTPS.ChangeWorkingDir('/WA') then    begin     FTPS.List('/WA', False);     LbDirectory.Items.Clear;     LbDirectory.Items := FTPS.FtpList.Lines;    end;   //parse for Directory Name   //TVFolder -> TTreeView   for c := 0 to LbDirectory.Items.Count -1 do     begin       s := LbDirectory.Items[c];       if Copy(s, 1,2) = 'dr' then TvFolder.Items.Add(nil, s);     end; ---------------------------------------------------------------------- KpjComp · 2012-07-26 09:53 Items give you everything in a structure you can parse to whatever format you wish, you can't just assign to a TStringList because it's not just strings. So if you want to know if a file is a directory you can look at the Directory flag, Do you want to know it's readable look at the readable flag, do what want to know the size look at the FileSize property. etc. For example -> Code: [Select]var   r:TFTPListRec; begin  ...  r := ftp.ftplist.items[i];  listbox1.items.Add(     format('Directory:%s  Readable:%s  FileSize:%d',         [BoolToStr(r.Directory),BoolToStr(r.Readable),r.FileSize])    ); ..