winexec("dir c:\windows\*.dll >>f.txt");
解决方案 »
- 真是神奇,不知为何?
- 关于嵌入IE工具栏的问题
- 帮助看这么一段代码(让窗口无焦点)怎么不行
- 搞不懂了!在chart控件上进行托拽时,如何判断鼠标已经离开了chart控件?
- 我帮别人做工作系统,请各位给点建议。
- 跪求一个delphi程序
- 注册表操作问题:REG.MoveKey;REG.WriteBinaryData;Reg.WriteExpandString等系列函数具体如何使用?
- 请大家推荐一本适合初学者看的开发数据库的书籍。
- 请教关于加密数据库datasource整体全加密的方法
- Delphi 6出新书了,是电脑报出的,叫Delphi 6入门宝典
- 我只剩下这么多分了,请各位帮帮忙
- 从SQL SERVER里读数据到ACCESS里,但有3万多条,速度太慢,怎么解决??
//==============================================================================
//统计指定目录下指定类型文件数量(包括子目录)**********************************
//==============================================================================
function GetFileCount(DirName,FileType: string): Integer;
var DirInfo: TSearchRec;
DosError: Integer;
begin
Result := 0;
DosError := FindFirst(DirName+'\*.*', FaAnyfile, DirInfo);
while DosError=0 do
begin
if ((DirInfo.Attr and FaDirectory)=faDirectory) and (DirInfo.Name<>'.') and (DirInfo.Name<>'..')
then Result := Result + GetFileCount(DirName + '\' + DirInfo.Name, FileType);
{$IF DEFINED(WIN32) AND DECLARED(UsingVCL)}
if ((DirInfo.Attr and FaDirectory)<>FaDirectory) and ((DirInfo.Attr and FaVolumeID)<>FaVolumeID)
{$ELSE}
if ((DirInfo.Attr and FaDirectory)<>FaDirectory)
{$IFEND}
then if Trim(FileType)='*.*'
then Inc(Result)
else if Pos(UpperCase(Copy(FileType,Pos('*',FileType)+1,Length(FileType)-1)),UpperCase(DirInfo.Name))>0
then Inc(Result);
DosError := FindNext(DirInfo);
end;
SysUtils.FindClose(DirInfo);
end;
var
sr : TSearchRec;
strlst: TStringList;
begin
strlst := TStringList.Create;
if (FindFirst('C:\Windows\*.dll', faAnyFile, sr) = 0) then
begin
repeat
strlst.Add(sr.Name);
until (FindNext(sr) <> 0);
FindClose(F);
end;
Memo1.Text := strlst.Text;
strlst.Free;
end;要获取子目录文件信息的话,可以使用递归进行处理。