protocol
osp
¶
Portable operating-system access protocol.
static
Public predicates¶
pid/1
¶
Returns the process identifier of the running process.
static
pid(PID)
pid(-integer)
- one
shell/2
¶
Runs an operating-system shell command and returns its exit status.
static
shell(Command,Status)
shell(+atom,-integer)
- one
shell/1
¶
Runs an operating-system shell command.
static
shell(Command)
shell(+atom)
- zero_or_one
absolute_file_name/2
¶
Expands a file name to an absolute file path. An environment variable at the beginning of the file name is also expanded.
static
absolute_file_name(File,Path)
absolute_file_name(+atom,-atom)
- one
decompose_file_name/3
¶
Decomposes a file name into its directory (which always ends with a slash; ./
is returned if absent) and its basename (that can be the empty atom).
static
decompose_file_name(File,Directory,Basename)
decompose_file_name(+atom,?atom,?atom)
- one
decompose_file_name/4
¶
Decomposes a file name into its directory (which always ends with a slash; ./
is returned if absent), name (that can be the empty atom), and extension (which starts with a .
when defined; the empty atom otherwise).
static
decompose_file_name(File,Directory,Name,Extension)
decompose_file_name(+atom,?atom,?atom,?atom)
- one
make_directory/1
¶
Makes a new directory. Succeeds if the directory already exists.
static
make_directory(Directory)
make_directory(+atom)
- one
make_directory_path/1
¶
Makes a new directory creating all the intermediate directories if necessary. Succeeds if the directory already exists.
static
make_directory_path(Directory)
make_directory_path(+atom)
- one
delete_directory/1
¶
Deletes an empty directory.
static
delete_directory(Directory)
delete_directory(+atom)
- one
change_directory/1
¶
Changes current working directory.
static
change_directory(Directory)
change_directory(+atom)
- one
working_directory/1
¶
Current working directory.
static
working_directory(Directory)
working_directory(?atom)
- zero_or_one
directory_files/2
¶
Returns a list of all files (including directories, regular files, and hidden directories and files) in a directory. File paths are relative to the directory.
static
directory_files(Directory,Files)
directory_files(+atom,-list(atom))
- one
directory_files/3
¶
Returns a list of files filtered using the given list of options. Invalid options are ignored. Default option values are equivalent to directory_files/2
.
static
directory_files(Directory,Files,Options)
directory_files(+atom,-list(atom),+list(compound))
- one
paths/1
: Possible values are relative
and absolute
. Default is relative
.type/1
: Possible values are all
, regular
, directory
. Default is all
.extensions/1
: Argument is a list of required extensions (using the format '.ext'
). Default is the empty list.prefixes/1
: Argument is a list of required file prefixes (atoms). Default is the empty list.suffixes/1
: Argument is a list of required file suffixes (atoms). Default is the empty list.dot_files/1
: Possible values are true
and false
. Default is true
.directory_exists/1
¶
True if the specified directory exists (irrespective of directory permissions).
static
directory_exists(Directory)
directory_exists(+atom)
- zero_or_one
ensure_directory/1
¶
Ensures that a directory exists, creating it if necessary.
static
ensure_directory(Directory)
ensure_directory(+atom)
- one
file_exists/1
¶
True if the specified file exists and is a regular file (irrespective of file permissions).
static
file_exists(File)
file_exists(+atom)
- zero_or_one
file_modification_time/2
¶
File modification time (which can be used for comparison).
static
file_modification_time(File,Time)
file_modification_time(+atom,-integer)
- zero_or_one
file_size/2
¶
File size (in bytes).
static
file_size(File,Size)
file_size(+atom,-integer)
- zero_or_one
file_permission/2
¶
True if the specified file has the specified permission (read
, write
, or execute
).
static
file_permission(File,Permission)
file_permission(+atom,?atom)
- zero_or_one
rename_file/2
¶
Renames a file or a directory.
static
rename_file(Old,New)
rename_file(+atom,+atom)
- zero_or_one
delete_file/1
¶
Deletes a file.
static
delete_file(File)
delete_file(+atom)
- one
ensure_file/1
¶
Ensures that a file exists, creating it if necessary.
static
ensure_file(File)
ensure_file(+atom)
- one
environment_variable/2
¶
Returns an environment variable value. Fails if the variable does not exists.
static
environment_variable(Variable,Value)
environment_variable(+atom,?atom)
- zero_or_one
time_stamp/1
¶
Returns a system-dependent time stamp, which can be used for sorting, but should be regarded otherwise as an opaque term.
static
time_stamp(Time)
time_stamp(-ground)
- one
date_time/7
¶
Returns the current date and time.
static
date_time(Year,Month,Day,Hours,Minutes,Seconds,Milliseconds)
date_time(-integer,-integer,-integer,-integer,-integer,-integer,-integer)
- one
cpu_time/1
¶
System cpu time in seconds.
static
cpu_time(Seconds)
cpu_time(-number)
- one
wall_time/1
¶
Wall time in seconds.
static
wall_time(Seconds)
wall_time(-number)
- one
operating_system_type/1
¶
Operating system type. Possible values are unix
, windows
, and unknown
.
static
operating_system_type(Type)
operating_system_type(?atom)
- one
command_line_arguments/1
¶
Returns a list with the command line arguments that occur after --
.
static
command_line_arguments(Arguments)
command_line_arguments(-list(atom))
- one
Protected predicates¶
(none)
Private predicates¶
(none)