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

getfileinfo

Fills info with information about the file or directory at path

Declaration

Source position: msefileutils.pas line 374

function getfileinfo(

  const path: filenamety;

  var info: fileinfoty

):Boolean;

Description

Fills info with information about the file or directory at path — such as its size, available through info.extinfo1.size — and returns False if it does not exist, as in the following example. The returned file times are in the system's native representation — normally UTC on Linux and local time on Windows; use sys_utctolocaltime/sys_localtimetoutc to convert.

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