How to find all MP3 files in a directory?

I recently started with delphi, and now I want to get all mp3 files from the directory. I want something like glob () php function.

+3
source share
5 answers

Old way to do this: approx:

var
  status : dword;
  sr : TSearchRec;
begin
  status := FindFirst('*.mp3',faAnyFile,sr);
  while status = 0 do
  begin

     // sr.Name is the filename; add it to a list
     // or something. Note there is no path so you
     // may need to add that back on somewhere

     status := FindNext(sr);
  end;
  SysUtils.FindClose(sr);

  // ...
end;
+12
source

Try IOUtils.TDirectory.

+3
source

, .

\JclFileUtils :

function BuildFileList(const Path: string; 
  const Attr: Integer; const List: TStrings; 
  IncludeDirectoryName: Boolean = False): Boolean;

JCL IDE. JCL ( ) http://sourceforge.net/projects/jcl/

+1

TFileListBox Delphi FileCtrl .

, Delphi 1 About Delphi , .

, Visible = False .

(, ), *.mp3.

-

+1

Source: https://habr.com/ru/post/1776081/


All Articles