File Functions


FileExists

FileExists(FilePath)

Returns True if the file at FilePath exists on disk.

Returns: Boolean

Examples:

FileExists("C:\Data\report.csv")
FileExists(ExportPath)

GetCreationTime

GetCreationTime(FilePath)

Returns the creation timestamp of the file at FilePath.

Returns: DateTime

Examples:

GetCreationTime("C:\Logs\app.log")

GetFile

GetFile(FilePath)

Reads the entire file at FilePath and returns its contents as a byte array (Byte()). Useful for reading binary files or passing file content to other functions.

Returns: Byte()

Examples:

Dim data = GetFile("C:\Images\photo.png")
WriteFile("C:\Backup\photo.png", data)

GetFileList

GetFileList(FilePath)

Returns an array of file names in the specified directory. FilePath is the directory path to list.

Returns: String() (array of file names)

Examples:

Dim files = GetFileList("C:\Reports\")
Dim count = Len(files)

GetFileName

GetFileName(FilePath)

Extracts the file name (including extension) from a full file path. Strips the directory portion.

Returns: String

Examples:

GetFileName("C:\Reports\summary.pdf")    ' "summary.pdf"
GetFileName(FullPath)

GetLastWriteTime

GetLastWriteTime(FilePath)

Returns the last-modified timestamp of the file at FilePath.

Returns: DateTime

Examples:

GetLastWriteTime("C:\Data\export.csv")

OpenAsFile

OpenAsFile(FileData, Extension)

Writes FileData to a temporary file with the given Extension and opens it with the system's default application for that file type. Useful for previewing documents, images, or spreadsheets from binary data.

Parameter Description
FileData File content as Byte() or String
Extension File extension without the dot, e.g. "pdf", "xlsx"

Returns: Boolean (True on success)

Examples:

OpenAsFile(GetFile("C:\report.pdf"), "pdf")
OpenAsFile(pdfBytes, "pdf")
OpenAsFile(htmlContent, "html")

WriteFile

WriteFile(FileName, FileData)

Writes FileData to a file at FileName. If FileData is a Byte(), the file is written as binary. Otherwise the data is written as text.

Parameter Description
FileName Full path of the file to write
FileData Content to write (Byte() for binary, or any value as text)

Returns: Boolean (True on success)

Examples:

WriteFile("C:\Output\report.txt", "Hello World")
WriteFile("C:\Output\image.png", GetFile("C:\Source\image.png"))