如何利用DELPHI語言,查找一個特定的檔案,獲取檔案存盤路徑?
uj5u.com熱心網友回復:
遍歷?需求太模糊。。。uj5u.com熱心網友回復:
findfirst/findnext多級子目錄還要遞回深入
uj5u.com熱心網友回復:
FindFirst FindNext FindEnd;貼一個我自己寫的函式;
procedure GetSubFiles(Path,Ext:string; var List:TStringList);
var
n: Integer;
F: TSearchRec;
begin
if Path[Length(Path)] <> '\' then Path:=path+'\';
n:=FindFirst(Path+'*.*',63,f);
while n=0 do
begin
Application.ProcessMessages;
if ((f.Name)[1] <> '.') then
begin
if Copy(F.Name,Length(f.Name)-(length(ext)-1),Length(ext)) =ext then List.Add(Path+f.Name);
if f.Attr=faDirectory then GetSubFiles(Path+f.Name,ext,List);
end;
n:=FindNext(f);
end;
end;
看這個 函式把遞回把所有型別檔案回傳到一個串列內 你再遍歷這個串列看看檔案在不再就好了
uj5u.com熱心網友回復:
如何查找檔案轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/146305.html
標籤:數據庫相關
