<< Click to Display Table of Contents >> Navigation: FindOnClick > FindOnClick For Advanced Users > Scripting > Functions > File Utils |
function DeleteFile(Filename);
Filename: The file to delete.
Return value: DeleteFile deletes the file named by Filename from the disk. If the file cannot be deleted or does not exist, the function returns False.
function RemoveDir(Directory);
Directory: The empty directory to delete.
Return value: RemoveDir deletes the empty directory from the disk. If the directory cannot be deleted (e.g. because it is not empty) or does not exist, the function returns False.
function CreateDir(Directory);
Directory: The empty directory to create.
Return value: CreateDir creates an empty directory. If the directory cannot be created (e.g. because it already exists or a parent directory does not exist), the function returns False.
function ForceDirectories(Directory);
Directory: The empty directory to create, including all its parent directories (if they do not already exist).
Return value: ForceDirectories creates an empty directory. If a parent directory does not already exist then it is created. If the directory cannot be created the function returns False.
function FileExists(Filename);
Filename: The file to test for existence.
Return value: FileExists returns True if the file specified by FileName exists. If the file does not exist, FileExists returns False.
function DirectoryExists(Directory);
Directory: The directory to test for existence.
Return value: DirectoryExists returns True if the directory specified by Directory exists. If the directory does not exist, DirectoryExists returns False.
procedure WriteAllText(Filename; String; Encoding = EFE_UTF8);
Filename: The file to write the string to.
String: The string to write to the file.
Encoding: The file encoding to use, with the default being EFE_UTF8
WriteAllText is used to write text to a file, optionally with a specific type of encoding. Note that the contents of the file are entirely replaced. Note that the directory must exist.
procedure AppendAllText(Filename; String; Encoding = EFE_UTF8);
Filename: The file to append the string to.
String: The string to append to the file.
Encoding: The file encoding to use, with the default being EFE_UTF8
AppendAllText is used to append text to the end of a file, optionally with a specific type of encoding. If the file does not exist then the function works as per WriteAllText. Note that the directory must exist.
function ReadAllText(Filename; String; Encoding = EFE_UTF8);
Filename: The file to read the the string from.
String: The string to write to the file.
Encoding: The file encoding to assume, with the default being EFE_UTF8
Return value: The contents of the file, in a string.
ReadAllText is used to read text from a file, optionally with a specific type of encoding. Note that the file must exist.
<%SBCOPYRIGHT%>