Unit 'msefileutils' Package
[Overview][Constants][Types][Classes][Procedures and functions][Index] [#msegui]

searchfiles

Returns the paths of the files matching afilename found in adirname

Declaration

Source position: msefileutils.pas line 241

function searchfiles(

  const afilename: filenamety;

  const adirnames: array of filenamety;

  const ainclude: fileattributesty = [fa_all];

  const aexclude: fileattributesty = [];

  const aoptions: dirstreamoptionsty = []

):filenamearty; overload;

function searchfiles(

  const afilename: filenamety;

  const adirname: filenamety;

  const ainclude: fileattributesty = [fa_all];

  const aexclude: fileattributesty = [];

  const aoptions: dirstreamoptionsty = []

):filenamearty; overload;

Description

Returns the paths of the files matching afilename found in adirname. afilename must be a simple filename, or a quoted list of simple filenames, and can contain the wildcards ? and *.

uses
  sysutils,
  msefileutils,
  msetypes,
  msesys; { fileinfoty }

var
  lfilename: filenamety;
  ldatetime: tdatetime;
  lfiles: filenamearty;
  lfileinfo: fileinfoty;

begin
  lfiles := searchfiles('demo*', '.');
  for lfilename in lfiles do
  begin
    writeln(lfilename);

    ldatetime := getfilemodtime(lfilename);
    writeln('Last modification: ', datetimetostr(ldatetime));

    if getfileinfo(lfilename, lfileinfo) then
      if fis_extinfo1valid in lfileinfo.state then
        writeln('Size: ', lfileinfo.extinfo1.size, ' bytes');

    if checkfileext(lfilename, ['prj']) then
      writeln('MSEide project');
  end;
end.

Documentation generated on: 2026-10-03