"关于Ftp(NMFtp控件)的问题!"(100分)

B

bain

Unregistered / Unconfirmed
GUEST, unregistred user!
我现在已经知道Ftp虚拟目录名,也可以连的上,请问怎么取得目录中的文件名列表!
最好给出代码!呵呵,谢了。
 
我现在已经知道Ftp虚拟目录名,也可以连的上,请问怎么取得目录中的文件名列表!
最好给出代码!呵呵,谢了。
 
没人愿意回答?
 
procedure TForm1.Button3Click(Sender: TObject);
Var
AttList: TStrings;
NameList: TStrings;
count: integer;
i: integer;
Att,Dir: String;
Begin
AttList := TStringList.Create;
NameList := TStringList.Create;
Dir := 'i:/Temp';

NMFTP1.ParseList:=true;
NMFTP1.Vendor:=NMOS_AUTO;
NMFTP1.List;
AttList.Assign(NMFTP1.FTPDirectoryList.Attribute);
NameList.Assign(NMFTP1.FTPDirectoryList.name);
Memo1.Lines.Assign(NMFTP1.FTPDirectoryList.name);
count := AttList.Count;
Try
mkdir(dir);
Except
End;
Chdir(dir);
If count = 0 Then
exit;

For i := 0 To count - 1 Do
Begin
Att := AttList.Strings;
If (Att[1] = '-') Then
Begin
Try
NMFTP1.Download(nameList.Strings, dir + '/' + NameList.Strings);
Except
End;
End;
If (Att[1] = 'd') Then
Begin
mkdir(NameList.strings);
Try
NMFTP1.ChangeDir(NameList.strings);
Except
End;
DownLoadDirectory(dir + '/' + NameList.Strings, NMFTP1);
chdir(dir);
Try
NMFTP1.ChangeDir('..');
Except
End;
End;
End;
End;
procedure TForm1.Button4Click(Sender: TObject);
begin
Screen.Cursor := crHourGlass;
NMFTP1.ParseList:=true;
NMFTP1.Vendor:=NMOS_AUTO;
NMFTP1.List;
Memo1.Lines.Assign(NMFTP1.FTPDirectoryList.name);
Screen.Cursor := crDefault;
end;
 
不要使用NMFTP控件,比较烂。如果你使用Delphi6.0的话,可以用Indy Clients页面的
IdFTP控件,Delphi有例子,很详细,我试过很好用的!
 
我以前使用NMFTP控件,有时会出现死机,传输文件时有时会中断.
还是换Indy吧,
即使你现在用Delphi5,也可以去网上下一个Indy装上,很好用
 
多人接受答案了。
 

Similar threads

回复
0
查看
886
不得闲
S
回复
0
查看
800
SUNSTONE的Delphi笔记
S
S
回复
0
查看
802
SUNSTONE的Delphi笔记
S
顶部