CONST LocalPath='D:\TEST'
procedure TInVisibleForm_F.DoDownload(Path: string);
var
i,Found:Integer;
StrArr:TStringDynArray;
MtStr:string;
MtDate:TDateTime;
SR:TSearchRec;
DirCount:Integer;
begin
idftp.List;
DirCount:=idftp.DirectoryListing.Count;
for I :=0 to DirCount-1 do
begin
if Pos('D:',Path)=0 then
LocalPath:=LocalPath+'\'+Path;
if DirCount <> idFTP.DirectoryListing.Count then
begin
repeat
idFTP.ChangeDirUp;
idFTP.List(nil);
until DirCount = idFTP.DirectoryListing.Count ;
end;
if idftp.DirectoryListing.Items[i].ItemType=ditDirectory then
begin
idftp.ChangeDir(idftp.DirectoryListing.Items[i].FileName);
DoDownload(idftp.DirectoryListing.Items[i].FileName);
end
else
begin
if not DirectoryExists(LocalPath) then
FileOperate.Directory.CreateDirectory(LocalPath);
if FileExists(LocalPath+'\'+idftp.DirectoryListing.Items[i].FileName) then
begin
Found:=FindFirst(LocalPath+'\'+idftp.DirectoryListing.Items[i].FileName,faAnyFile,SR);
while Found=0 do
begin
MtStr:=FormatDateTime('yyyy-mm-dd hh:mm:ss',idftp.DirectoryListing.Items[i].ModifiedDate);
MtDate:=StrToDateTime(MtStr);
if FileOperate.CovFileDate(SR.FindData.ftLastWriteTime)<MtDate then
begin
if SR.Name<>'SmartDownLoad.exe' then
idftp.Get(idftp.DirectoryListing.Items[i].FileName,LocalPath+'\'+SR.Name,true);
end;
Found:=FindNext(SR);
end;
end
else
begin
if SR.Name<>'SmartDownLoad.exe' then
idftp.Get(idftp.DirectoryListing.Items[i].FileName,LocalPath+'\'+idftp.DirectoryListing.Items[i].FileName,True);
end;
end;
end;
end;递归调用的时候下载文件路径老是不对
比如服务器上有文件夹1\2\3\4\5,里面还有些文件
然后下到我硬盘里的路径会变成1\2\3\1\2\4\5,或者其他模样的
请问我的代码该怎么调整
解决方案 »
- delphi7安装GridPanel控件
- 公共变量的互斥。。。。。。。。。。。
- 减肥20公斤目标完成,散分
- 请各位求翻译以下文章,小弟在此深表感谢!
- 在com里面动态创建TXMLDocument的问题,急!!!都来看看
- 在delphi里面怎样才能弹出一个带‘确认’,‘取消’的对话框,点取消后就不执行后面的语句啦!谢谢!
- 请问<<delphi控件及应用>>这本书在哪可以下载,请给出地址。
- @@@@@诚招重庆籍DELPHI程序员,有意请联系[email protected]
- 求助。有关frame的内容
- NMUDP的问题
- 求教deiphl中插入shocwaveflash之后如何填写一个相对地址
- 如何改变dbgrideh表格当前行的表格线颜色?
begin
t:=tt.items[j];
if IdFTP.DirectoryListing.Items[j].ItemType = ditfile then //如果是文件
begin
if Length(t.FileName)<11 then name :='data.txt'
else name:=t.FileName;
try
IdFTP.Get(t.FileName ,ip.text+'\'+ftp_date.Text+'\'+name,True);
except
end;
end;
end;谁知道 如果该循环有1000次会经常导致无响应。