![]() |
Order and save right now!
20% off with the 729824315 dicscount code for Ultimate Pack and any another product for Delphi from Greatis Programming! |
⤷ Detect all files in directory
Use SearchFiles procedure. You should specify a directory, and after that, this function returns a list of files in this folder.Main moments are FindFirst and FindNext functions.
procedure TForm1.SearchFiles(St: string);
var
MySearch: TSearchRec;
FindResult: Integer;
begin
FindResult:=FindFirst(St+'\*.*', faAnyFile, MySearch);
if (MySearch.Name<>'.')and(MySearch.Name<>'..') then
Memo1.Lines.Add(MySearch.Name);
while FindNext(MySearch)=0 do
begin
if (MySearch.Attr<>faDirectory)and
(MySearch.Name<>'.')and
(MySearch.Name<>'..') then
Memo1.Lines.Add(MySearch.Name);
end;
end;
- See also
- TFileSearch component
- Related components
- TFileSearch
- TFolderMonitor
- TFileVersion
-
More for developers