如何用delphi制作ftp,并能定时从ftp服务器上取的文件?

yyhyq2000 2003-09-04 10:02:54
本人最近在做一个ftp的软件,这个软件能定时从ftp上取文件,手动的已经实现。请教各位大哥大姐指教小弟。
...全文
137 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
human_2 2003-09-04
  • 打赏
  • 举报
回复
然后在控件内加个时间控件,到一定时候触发下载的过程,就OK
human_2 2003-09-04
  • 打赏
  • 举报
回复
With IdFTP1 do
begin
StatusBar1.SimpleText := '连接服务器...';
try
User := edt_userId.Text;
Password := edt_Password.Text;
Host := edt_computer.Text;
Connect;
except
Showmessage('连接FTP服务器失败!');
exit;
end;
StatusBar1.SimpleText := '连接服务器成功,正在获取目录信息...';
end;


//改变到取数目录
ls_trn_date := trim(edt_trn_date.text);
ls_Path := ExtractFilePath(Application.Exename);
ls_Path := ls_Path +ls_trn_date;

if not DirectoryExists(ls_Path) then
if not CreateDir(ls_Path) then
raise Exception.Create('Cannot create '+ls_Path);



ls_currentPath := '/aaaa/Jdata/' + ls_trn_date;

IdFTP1.ChangeDir(ls_currentPath);
IdFTP1.List(FileListBox1.Items ,'',false);

Progressbar1.Position:= 0;
Progressbar1.Max := FileListBox1.items.count ;

StatusBar1.SimpleText := '开始接收数据...';
For i:= 0 to FileListBox1.items.count-1 do
begin
ProgressBar1.StepBy(1);
Application.ProcessMessages ;

Line := FileListBox1.Items[i];
Name := trim( GetNameFromDirLine(Line, IsDirectory) );

if copy(Name,length(Name)-2,3)= 'txt' then
begin
StatusBar1.SimpleText := '正在接收'+ Name;

IdFTP1.Get(Name,ls_Path+'\'+Name,true);
end;

end;




StatusBar1.SimpleText :=
'接收数据完成!';
yyhyq2000 2003-09-04
  • 打赏
  • 举报
回复
谢谢了,我试试,,

1,594

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 网络通信/分布式开发
社区管理员
  • 网络通信/分布式开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧