1.3. Filesystem API

The Filesystem API provides file system utilities.

Functions

function isdir(string path)

Check if the specified path is a directory.

Return

true if it’s a direcory, false otherwise.

Parameters
  • path: to check.

function mkdir(string path)

Create the specified directory structure.

Return

true on success, false otherwise.

Parameters
  • path: the directory tree to create.

function notEmptyFile(string filename)

Check if the specified file is not empty.

Return

true if file is not empty, false otherwise.

Parameters
  • filename: the file to check.

function exists(string path)

Check if the specified file or directory exists.

Return

true if the path exists, false otherwise.

Parameters
  • path: the path to check.

function fileLastChange(string filename)

Get the last time the specified file has changed.

Return

last modification time on success, -1 otherwise.

Parameters
  • filename: the file to query.

function readdir(string path)

List directory files and dirs contents.

Return

table (entry_name -> entry_name) on success, nil otherwise.

Parameters
  • path: the directory to traverse.

function rmdir(string path)

Recursively remove a file or directory.

Parameters
  • path: the path to remove.