如题:
因为AFiles中获得的结果中包括了目录信息,如何区分目录与文件?
因为AFiles中获得的结果中包括了目录信息,如何区分目录与文件?
解决方案 »
- 如何偵測鍵盤被按下
- 当Tadoquery 组件的sql中有参数为时间的时候,如何设置时间的值(除了通过string之外)?
- 捕获不到数据库连接失败的问题
- 高手请指教:我用Delphi5协议各CGI,使用BDE连接Oracle8.1.7,了解失败,但是在普通程序中一切OK,在CGI中使用Interbase或其他数据库都可以,请
- 用DELPHI怎么写进Ring0
- 请教:怎样做数据库的安装程序?
- 请教delphi7导EXEL到ACCESS的问题
- 一个困惑我多天的关于ActiveX的问题,详情见内!!分不够可再加,不食言!!!
- ...发帖的地方呢
- sql语句的求和结果怎么用edit表示
- 请问在程序中如何给 DBGridEH 控件的单元格赋值?
- 怎样控制 选中 DBGRIDEH 的某一单元格后字体的颜色?
changdir();
expect
不是目录
end;
你用CHANGDIR如果有异常就是文件不是目录,如果不异常就是目录不是文件
Var
LS: TStringList;
FileCount : Integer;
newItem : TListItem;
FolderCount : Integer;
begin
try
LS := TStringList.Create;
FTPClient.ChangeDir(CbxHistory.Text);
LViewRemoteFile.Items.Clear;
FTPClient.List(LS);
FolderCount := 0;
for FileCount:=0 to LS.Count - 1 do
begin
if FTPClient.DirectoryListing.Items[FileCount].ItemType = ditDirectory then
begin
newItem := LViewRemoteFile.Items.Insert(FolderCount);
newItem.ImageIndex := 0;
newItem.subItems.Add('文件夹');
end
else
begin
newItem := LViewRemoteFile.Items.Add;
newItem.ImageIndex := 1;
newItem.subItems.Add('');
end ;
newItem.Caption := FTPClient.DirectoryListing.Items[FileCount].FileName;
newItem.subItems.Add(IntToStr(FTPClient.DirectoryListing.Items[FileCount].Size));
newItem.subItems.Add(DateToStr(FTPClient.DirectoryListing.Items[FileCount].ModifiedDate));
end;
finally
LS.Free;
end;
end;