Files

Trace(ReadFileContents(IncludeTrailingPathDelimiter(GetApplicationPath) + 'notes.txt'));
Procedure Description
function GetApplicationPath: string; Return the absolute path of the current Usine application folder
function FileGetTempFileName(const Caption, Ext: string): string; Generate a unique temporary file path in the Usine temp folder, using Caption as a suffix and Ext as the file extension
procedure FindFiles(const Directory: String; Extensions: String; Recursive: Boolean; Result: TStringList); Find all files in a directory matching specific extensions (e.g. 'pat,wkp'), optionally searching recursively
procedure FindDirectories(const Directory: String; Recursive: Boolean; Result: TStringList); Find all subdirectories within a directory, optionally recursively
function WriteFileContents(const FileName: String; const Text: String; Append: Boolean): Boolean; Write text to a file, optionally appending to existing content
function ReadFileContents(const FileName: String): String; Read the contents of a text file and return as string
function CreateDirectory(const Directory: String): Boolean; Create a single-level directory
function ForceDirectories(const Directory: String): Boolean; Create a full directory path, including intermediate directories
function DeleteDirectory(const Directory: String; OnlyChildren: Boolean): Boolean; Delete a directory or only its contents
function DeleteFile(const FileName: String): Boolean; Delete a specified file
function RenameFile(const OldFileName, NewFileName: String): Boolean; Rename or move a file
function CopyFile(const SourceFileName, DestFileName: String; Overwrite: Boolean = False): Boolean; Copy a file, optionally overwriting an existing one
function FileExists(const FileName: String): Boolean; Check whether a file exists
function DirectoryExists(const Directory: String): Boolean; Check whether a directory exists
function FileAge(const FileName: String): Int32; overload; Get the modification date/time of a file as an integer timestamp
function FileAge(const FileName: String; out FileDateTime: TDateTime): Boolean; overload; Get the modification date/time of a file as a TDateTime value
function ExtractFilePath(const FileName: String): String; Extract the directory path from a full file name
function ExtractFileDrive(const FileName: String): String; Extract the drive or volume from a file path
function ExtractFileName(const FileName: String): String; Extract the file name (without path) from a full path
function ExtractFileExt(const FileName: String): String; Extract the file extension from a file name
function ExtractFileDir(const FileName: String): String; Extract the directory portion of a full path
function ExpandFileName(const FileName: String): String; Convert a relative path into an absolute path
function ExtractRelativePath(const BaseName, DestName: String): String; Compute the relative path from one directory to another
function IncludeTrailingPathDelimiter(const Path: String): String; Ensure a path ends with the correct path delimiter
function ExcludeTrailingPathDelimiter(const Path: String): String; Remove the trailing path delimiter from a path
function IncludeTrailingBackslash(const Path: String): String; Ensure a path ends with a backslash (\)
function ExcludeTrailingBackslash(const Path: String): String; Remove a trailing backslash from a path
function IncludeLeadingPathDelimiter(const Path: String): String; Ensure a path starts with a path delimiter
function ExcludeLeadingPathDelimiter(const Path: String): String; Remove a leading path delimiter from a path
function SubFileExt(FileName: String): string; Return the file name without its extension
function PathDelim: string; Return the platform-specific path delimiter ('/' on macOS, '\\' on Windows)
procedure CreateDir(Dir: String); Create a directory (legacy compatibility version)

more about scripts

version 7.0.250121

Edit All Pages