Skip to main content

1E 23.11 (SaaS)

FileSystem.GetFile

Method

GetFile

Module

FileSystem

Library

Core

Action

Returns the content of a text file.

Parameters

FilePath (string): The full path of the file. The path can include environment variables represented by the local shell format (e.g. %env% on Windows), and wildcards such as '*' for multiple characters and '?' for a single character.

Return values

If nothing is found then the method returns success but no rows, this is because a complex instruction script may want to continue to execute rather than fail abruptly.

For each file found:

  • FileName (string): The full path, with any wildcards and environment variables expanded.

  • Content (string): The full content of the file.

Example

FileSystem.GetFile(FilePath:"c:\\tmp\\i*.txt");
FileSystem.GetFile(FilePath:"c:\\tmp\\ip?.txt");
FileSystem.GetFile(FilePath:"%programdata%\\1E\\Client\\1E.Client.log");

Platforms

  • Windows

  • Linux

  • MacOS

Notes

Do not use on a binary file - the returned Content will probably be corrupted.

This method accepts ANSI encodings for files. Results are unpredictable for other encodings. For example, UCS2-LE (UTF16-LE) files will only be partially returned, resulting in text such as '1' in the Tachyon Explorer.

There is a limit of up to 10MB on the size of the file to be fetched. If a file is this size or larger, then its contents will not be fetched. If no files are fetched due to this limit, the method fails. But it is not an error if no files match the FilePath, although no results are returned in that case.