A
amsea
Unregistered / Unconfirmed
GUEST, unregistred user!
Procedure DownLoadDirectory(Dir: String; FtpSvr: TNMFTP);
Var
AttList: TStrings;
NameList: TStrings;
count: integer;
i: integer;
Att: String;
Begin
AttList := TStringList.Create;
NameList := TStringList.Create;
FtpSvr.ChangeDir('public_html');
FtpSvr.List;
AttList.Assign(FtpSvr.FTPDirectoryList.Attribute);
NameList.Assign(FtpSvr.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
FtpSvr.Download(nameList.Strings, dir + '/' + NameList.Strings);
Except
End;
End;
If (Att[1] = 'd') Then
Begin
mkdir(NameList.strings);
Try
FtpSvr.ChangeDir(NameList.strings);
Except
End;
DownLoadDirectory(dir + '/' + NameList.Strings, FtpSvr);
chdir(dir);
Try
FtpSvr.ChangeDir('..');
Except
End;
End;
End;
End;
Var
AttList: TStrings;
NameList: TStrings;
count: integer;
i: integer;
Att: String;
Begin
AttList := TStringList.Create;
NameList := TStringList.Create;
FtpSvr.ChangeDir('public_html');
FtpSvr.List;
AttList.Assign(FtpSvr.FTPDirectoryList.Attribute);
NameList.Assign(FtpSvr.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
FtpSvr.Download(nameList.Strings, dir + '/' + NameList.Strings);
Except
End;
End;
If (Att[1] = 'd') Then
Begin
mkdir(NameList.strings);
Try
FtpSvr.ChangeDir(NameList.strings);
Except
End;
DownLoadDirectory(dir + '/' + NameList.Strings, FtpSvr);
chdir(dir);
Try
FtpSvr.ChangeDir('..');
Except
End;
End;
End;
End;