Also, ich hab mir das so gebaut: (Du brauchst auf der Form einen TButton und eine TListView)
//Locale Variablen
var
Form1: TForm1;
ListBx1, TempBox: TStrings;
Folder: String;
//Hier die Proceduren...
procedure TForm1.LoadtoBox(ListBox: TStrings);
begin
while TempBOx.Count ] 0 do begin
ListBox.Add(TempBox.Strings[0]);
TempBox.Delete(0);
end;
end;
procedure TForm1.FtpListHandler(Listing: String);
var
Text: String;
begin
Text := Listing;
if Copy(Text,0,1) = 'd' then begin
Text := Copy(Text,56,Length(Text) - 55);
ListBx1.Add(Folder + Text);
end
else
begin
Text := Copy(Text,56,Length(Text) - 55);
TempBox.Add(Folder + Text)
end;
end;
procedure TForm1.GetList(Ip: String; ListBox: TStrings);
var
i, x: Integer;
NMFTP1: TNMFTP;
begin
ListBx1 := TStringList.Create;
TempBox := TStringList.Create;
NMFtp1 := TNMFTP.Create(Self);
NmFtp1.UserID := 'anonymous';
NmFtp1.Password := 'user@on.net';
NmFtp1.TimeOut := 60000;
NmFtp1.Host := IP;
NmFtp1.Port := 21;
Folder := '/';
NMFtp1.Connect;
NMFtp1.OnListItem := FtpListHandler;
NMFtp1.list;
while ListBx1.Count ] 0 do begin
Folder := ListBx1.Strings[0] + '/';
try
try
NMFtp1.ChangeDir(folder);
finally
NMFtp1.list;
end;
except
end;
ListBx1.Delete(0);
LoadtoBox(ListBox);
end;
NmFtp1.Disconnect;
NmFtp1.Free;
ListBx1.Free;
LoadtoBox(ListBox);
TempBox.Free;
for i := 0 to (ListBox.Count - 1) do
for x := 0 to (ListBox.Count - 1) do
if (ListBox.Strings[x] < ListBox.Strings[i]) and (x > i) then
begin
ListBox.Insert(i, ListBox1.Items[x]);
ListBox.Delete(x + 1);
end;
end;
//Und so wird es ausgeführt...
procedure TForm1.Button1Click(Sender: TObject);
begin
GetList(Edit1.Text, ListBox1.Items);
ShowMessage('Fertig');
end;
//By EgoFelix :D
Ich hoffe, das funktioniert alles so bei dir...
Viel Spass