O/S Access   (SYE_OS_API unit)

Get_File_Details

Retrieves the size and last update time (UTC) of a file on disk.
Function Get_File_Details(CONST FileName: String; VAR Size_In_Bytes: Int64; VAR Last_Update_UTC: TDateTime): Boolean;

Parameters

  • FileName: String; the full path to the file.
  • Size_In_Bytes: Int64; output parameter that receives the file size in bytes.
  • Last_Update_UTC: TDateTime; output parameter that receives the file's last modification time in UTC.

Return Value

Returns True if the file exists and details were successfully retrieved.
Returns False if the file is not accessible or not found.

File_Exists

Checks whether a file exists, meets a minimum size, and has a valid last-write UTC date.
Function File_Exists(CONST FileName: String; CONST Minimal_Size_In_Bytes: Int64 = 3): Boolean;

Parameters

  • FileName: String; the full path to the file.
  • Minimal_Size_In_Bytes: Int64; minimum file size required to consider it valid (default is 3).

Return Value

Returns True if file details can be read, the size is at least the requested minimum, and the last-write date is greater than 100.
Returns False otherwise.

Directory_Exists

Checks if a directory exists on disk.
Function Directory_Exists(Directory: String): Boolean;

Parameters

  • Directory: String; the path of the directory to check.

Return Value

Returns True if the directory exists.
Returns False if it does not.

Delete_File

Attempts to delete a file, with optional retry attempts.
Function Delete_File(FileName: String; Attempts: Integer = 1): Boolean;

Parameters

  • FileName: String; full path of the file to delete.
  • Attempts: Integer; number of attempts, limited to 1–20. Failed attempts are separated by 500 ms.

Return Value

Returns True if the file was deleted or did not exist. Returns False if deletion fails.

Rename_File

Moves a file to a new name, with optional repeated attempts.
Function Rename_File(OldName, NewName: String; Attempts: Integer = 1): Boolean;

Parameters

  • OldName: String; the original filename including path.
  • NewName: String; the desired new filename including path.
  • Attempts: Integer; number of attempts, limited to 1–20. Failed attempts are separated by 500 ms.

Return Value

Deletes an existing target file before moving the source. Returns True when the names already match or the move succeeds.
Returns False when the source is absent or the move fails. If the target exists, it may be deleted even when the move fails.

Rename_Folder

Renames a folder after normalizing the old and new paths. Uses the Windows MoveFileW API.
Function Rename_Folder(OldName, NewName: WideString): Boolean;

Parameters

  • OldName: WideString; the current full path of the folder.
  • NewName: WideString; the new full path for the folder.

Return Value

Returns True if the folder was successfully renamed.
Returns False if the operation failed.

Make_File_Readonly

Marks a file as read-only using Windows attributes.
Function Make_File_Readonly(FileName: String): Boolean;

Parameters

  • FileName: String; the full path to the file.

Return Value

Returns True if the attribute was successfully set.
Returns False if the operation failed.

Copy_File

Copies a single file through a temporary _copy file at the target path.
Function Copy_File(CONST Source, Target: String; CONST CopySourceFileTime: Boolean): Boolean;

Parameters

  • Source: String; path of the file to copy.
  • Target: String; destination path of the copied file.
  • CopySourceFileTime: Boolean; if True, preserves the original file's timestamp.

Return Value

Returns True if the source and target names match, or if the copy and final rename succeed.
Returns False for an unavailable source, insufficient disk space, or a failed copy or rename.
The target file is deleted before copying begins; check the return value before relying on the target.

Copy_Files

Recursively copies files matching a mask from a source folder and its subfolders to a target folder.
Function Copy_Files(SourcePath, TargetPath, FileMask: String; CopySourceFileTime: Boolean): Boolean;

Parameters

  • SourcePath: String; the folder to copy files from.
  • TargetPath: String; the destination folder.
  • FileMask: String; pattern for selecting files (e.g. *.txt).
  • CopySourceFileTime: Boolean; if True, preserves timestamps.

Return Value

Returns True if at least one file was copied successfully, including in a subfolder.
Returns False if no file was copied; it does not report whether every matching file succeeded.
The source folder must exist. The target folder is created if needed.

Force_Directories

Creates a directory and missing parent directories for an absolute drive or UNC path.
Function Force_Directories(Dir: String): Boolean;

Parameters

  • Dir: String; the full path to create.

Return Value

Returns True if the path exists or was successfully created.
Returns False on failure, including relative paths and paths shorter than three characters.

Kill_Files

Attempts to delete files matching a mask in the given folder; subfolders are not scanned.
Procedure Kill_Files(Path, FileMask: String);

Parameters

  • Path: String; the directory to scan for files.
  • FileMask: String; the file pattern to delete (e.g. *.tmp).

Kill_Directory

Attempts to delete a folder and all of its contents recursively. This procedure does not report failures.
Procedure Kill_Directory(Path: String);

Parameters

  • Path: String; the directory to delete.

_TrueType_Fonts_List

Returns a list of installed TrueType font names on the system.
Function _TrueType_Fonts_List: String;

Return Value

Returns a sorted string of TrueType font names that begin with a Latin letter, separated by line breaks.
This routine is implemented only for Windows.