procedure findall(disk,path: String; var fileresult: Tstrings);
var
fpath: String;
fs: TsearchRec;
begin
fpath:=disk+path+'\*.*';
if findfirst(fpath,faAnyFile,fs)=0 then
begin
if (fs.Name<>'.')and(fs.Name<>'..') then
if (fs.Attr and faDirectory)=faDirectory then
findall(disk,path+'\'+fs.Name,fileresult)
else
if UPPERCASE((ExtractFileExt(fs.Name))='.DAT') OR UPPERCASE((ExtractFileExt(fs.Name))='MPEG') then
fileresult.add(disk+path+'\'+fs.Name);
while findnext(fs)=0 do
begin
if (fs.Name<>'.')and(fs.Name<>'..') then
if (fs.Attr and faDirectory)=faDirectory then
findall(disk,path+'\'+fs.Name,fileresult)
else
if UPPERCASE((ExtractFileExt(fs.Name))='.DAT') OR UPPERCASE((ExtractFileExt(fs.Name))='MPEG') then
fileresult.add(disk+path+'\'+fs.Name);
end;
end;
findclose(fs);
end; var
fileresult: TStrings;
begin
fileresult := TStringList.Create;
try
findall('C:','', fileresult);
……; //文件路径保存在fileresult中。
finally
fileresult.free;
end;
end;
var
fpath: String;
fs: TsearchRec;
begin
fpath:=disk+path+'\*.*';
if findfirst(fpath,faAnyFile,fs)=0 then
begin
if (fs.Name<>'.')and(fs.Name<>'..') then
if (fs.Attr and faDirectory)=faDirectory then
findall(disk,path+'\'+fs.Name,fileresult)
else
if UPPERCASE((ExtractFileExt(fs.Name))='.DAT') OR UPPERCASE((ExtractFileExt(fs.Name))='MPEG') then
fileresult.add(disk+path+'\'+fs.Name);
while findnext(fs)=0 do
begin
if (fs.Name<>'.')and(fs.Name<>'..') then
if (fs.Attr and faDirectory)=faDirectory then
findall(disk,path+'\'+fs.Name,fileresult)
else
if UPPERCASE((ExtractFileExt(fs.Name))='.DAT') OR UPPERCASE((ExtractFileExt(fs.Name))='MPEG') then
fileresult.add(disk+path+'\'+fs.Name);
end;
end;
findclose(fs);
end; var
fileresult: TStrings;
begin
fileresult := TStringList.Create;
try
findall('C:','', fileresult);
……; //文件路径保存在fileresult中。
finally
fileresult.free;
end;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货