os: Operating system functionality

Table of content

Introduction

The os: module provides access to operating system functionality. The interface is intended to be uniform across operating systems.

The builtin module also contains some operating system utilities. The unix: module contains utilities that are specific to UNIX operating systems.

Function usages are given in the same format as in the reference doc for the builtin module.

Functions

os:exists

os:exists $path

Reports whether a file is known to exist at path.

os:-is-exist

os:-is-exist $exc

Reports whether an exception is caused by the fact that a file or directory already exists.

os:-is-not-exist

os:-is-not-exist $exc

Reports whether an exception is caused by the fact that a file or directory does not exist.

os:mkdir

os:mkdir &perm=0o755 $path

Creates a new directory with the specified name and permission (before umask).

os:remove

os:remove $path

Removes the file or empty directory at path.

If the path does not exist, this command throws an exception that can be tested with os:-is-not-exist.

os:remove-all

os:remove-all $path

Removes the named file or directory at path and, in the latter case, any children it contains. It removes everything it can, but returns the first error it encounters.

If the path does not exist, this command returns silently without throwing an exception.