Skip to content
timrademaker edited this page Jan 25, 2021 · 7 revisions

Checking if a Path Exists

exists

Returns true if a file exists at the specified path.

Parameters

filePath: The path to the file.

dirExists

Returns true if a folder exists at the specified path.

Parameters

directory: The path to the folder.

nameExists

Returns true if either a file or a folder exists at the specified path.

Parameters

path: The path to the file or folder.

Creating and Deleting Items

create

Used to create a new file with some content if the file doesn't exist.

Parameters

filePath: The path to the file that should be created.

content: The content that should be written to the file.

write

Used to write to a file. If the file exists, it is overwritten. If it doesn't exist, the file is created.

Parameters

filePath: The path to the file that should be created.

content: The content that should be written to the file.

createDir

Create a folder at the specified path, if it doesn't already exist.

Parameters

directory: The path to the folder that should be created.

delete

Delete a file or folder, if it exists.

Parameters

path: The path of the file that should be deleted.

zip

Zip a folder or a file.

Parameters

pathToCompress: The path to the file or folder to compress.

destinationPath: The path where the zip file should be placed.

optimalCompression (optional): If true, the archive is compressed as much as possible. This is a trade-off between compression speed and archive size. Defaults to true.

unzip

Unzip an archive.

Parameters

zipFile: The path of the archive to unpack.

destinationPath: The folder in which the unpacked archive should be placed.

download

Download a file.

Parameters

downloadUrl: The URL to download the file from.

outputFile: The file to which the downloaded file should be output.

Copying and Renaming

copy

Copy a file to a new location.

Parameters

fromPath: The path of the file to copy.

toPath: The path to copy the file to. Can also be a file name.

force: If true, copy the file to the destination even if the file already exists. Defaults to false.

recurse: Whether to copy subfolders and contents or not. Defaults to true.

rename

Rename a file.

Parameters

path: The path to the file or folder that should be renamed.

newName: The new name for the file or folder.

force: If true, change the file- or folder's name even if it is set to read only. Defaults to false.

Clone this wiki locally