T
tsh2005
Unregistered / Unconfirmed
GUEST, unregistred user!
本人用TIDFTP做了一个上传下载文件的工具,其中下载的过程如下:
procedure DownLoadFiles(CurrentDir:string;FtpDir:String;FtpSvr: TIdFTP);
var
i,count:integer;
attList:TstringList;
strname:string;
begin
attList:=TstringList.Create;
chdir(CurrentDir);
ftpsvr.List(attList);
// count:=attlist.Count;
for i:=0 to attList.Count-1 do begin
if ftpsvr.DirectoryListing.Items.ItemType=ditFile then
begin
strname:=ftpsvr.DirectoryListing.Items.FileName;
try
ftpsvr.Get(strname,strname);
except
end;
end;
end;
end;
当第一次下载时,不会有错,第二次下载时文件已存在时,会出错,我用了EXCEPT来跳过,不过不能覆盖文件,请问有没有办法覆盖啊?
procedure DownLoadFiles(CurrentDir:string;FtpDir:String;FtpSvr: TIdFTP);
var
i,count:integer;
attList:TstringList;
strname:string;
begin
attList:=TstringList.Create;
chdir(CurrentDir);
ftpsvr.List(attList);
// count:=attlist.Count;
for i:=0 to attList.Count-1 do begin
if ftpsvr.DirectoryListing.Items.ItemType=ditFile then
begin
strname:=ftpsvr.DirectoryListing.Items.FileName;
try
ftpsvr.Get(strname,strname);
except
end;
end;
end;
end;
当第一次下载时,不会有错,第二次下载时文件已存在时,会出错,我用了EXCEPT来跳过,不过不能覆盖文件,请问有没有办法覆盖啊?