hi all
does nay one use indy ftp client component to connect to vms operating system .
after doing idftp.list there is no any way to know if the list line is a file or directory , and also idFtp.size not working.
please help.
thanks
procedure TfrmMain.GetFileList;
var DirList: TIdFTPListItems;
DirItem: TIdFTPListItem;
i: Integer;
buf: string;
begin
if txtCurrentDir.Text <> '' then begin
ListBox1.Clear;
ListBox1.Items.Add('..');
try
buf := sckFTP.RetrieveCurrentDir;
except end;
if buf[1] <> '/' then buf := '/' + buf;
if buf[Length(buf)] <> '/' then buf := buf + '/';
txtCurrentDir.Text := buf;
try
sckFTP.ChangeDir(txtCurrentDir.Text);
except end;
try
sckFTP.List(nil);
DirList := sckFTP.DirectoryListing;
except end;
if Assigned(DirList) then begin
for i := 0 to DirList.Count - 1 do begin
DirItem := DirList.Items[i];
if DirItem.ItemType = ditDirectory then begin
if (DirItem.FileName <> '.') and (DirItem.FileName <> '..') then ListBox1.Items.Add('/' + DirItem.FileName)
end;
end;
for i := 0 to DirList.Count - 1 do begin
DirItem := DirList.Items[i];
if DirItem.ItemType = ditFile then ListBox1.Items.Add(DirItem.FileName);
end;
end;
end;
end;
procedure TfrmMain.GetFileList;
var DirList: TIdFTPListItems;
DirItem: TIdFTPListItem;
i: Integer;
buf: string;
begin
if txtCurrentDir.Text <> '' then begin
ListBox1.Clear;
ListBox1.Items.Add('..');
try
buf := sckFTP.RetrieveCurrentDir;
except end;
if buf[1] <> '/' then buf := '/' + buf;
if buf[Length(buf)] <> '/' then buf := buf + '/';
txtCurrentDir.Text := buf;
try
sckFTP.ChangeDir(txtCurrentDir.Text);
except end;
try
sckFTP.List(nil);
DirList := sckFTP.DirectoryListing;
except end;
if Assigned(DirList) then begin
for i := 0 to DirList.Count - 1 do begin
DirItem := DirList.Items[i];
if DirItem.ItemType = ditDirectory then begin
if (DirItem.FileName <> '.') and (DirItem.FileName <> '..') then ListBox1.Items.Add('/' + DirItem.FileName)
end;
end;
for i := 0 to DirList.Count - 1 do begin
DirItem := DirList.Items[i];
if DirItem.ItemType = ditFile then ListBox1.Items.Add(DirItem
end;
end;
end;
end;