Next: User Toplevel Manipulation
Up: Built-In Predicates
Previous: Unix Interaction
- access_file( +File, +Mode)
Succeeds when File exists and can be accessed by this prolog
process under mode Mode. Mode is one of the atoms
read
, write
, append
, exist
, none
or
execute
. File may also be the name of a directory. Fails
silently otherwise. access_file(File, none)
simply succeeds
without testing anything.
- exists_file( +File)
Succeeds when File exists. This does not imply the user has read
and/or write permission for the file.
- file_directory_name( +File, -Directory)
Extracts the directory-part of File. The resulting Directory
name ends with the directory separator character /. If File
is an atom that does not contain any directory separator characters, the
empty atom '' is returned. See also file_base_name/2.
- file_base_name( +File, -BaseName)
Extracts the filename part from a path specification. If File does
not contain any directory separators, File is returned.
- same_file( +File1, +File2)
Succeeds if both filenames refer to the same physical file. That is,
if File1 and File2 are the same string or both names exist
and point to the same file (due to hard or symbolic links and/or
relative vs. absolute paths).
- exists_directory( +Directory)
Succeeds if Directory exists. This does not imply the user has read,
search and or write permission for the directory.
- delete_file( +File)
Unlink File from the Unix file system.
- rename_file( +File1, +File2)
Rename File1 into File2. Currently files cannot be moved
across devices.
- size_file( +File, -Size)
Unify Size with the size of File in characters.
- time_file( +File, -Time)
Unify the last modification time of File with Time.
Time is a floating point number expressing the seconds elapsed since
Jan 1, 1970.
- absolute_file_name( +File, -Absolute)
Expand Unix file specification into an absolute path. User home
directory expansion (~
and ~user
) and variable expansion
is done. The absolute path is canonised: references to `.' and `..' are
deleted. SWI-Prolog uses absolute file names to register source files
independant of the current working directory.
- absolute_file_name( +Spec, +Options, -Absolute)
Converts the given file specification into an absolute path.
Option is a list of options to guide the conformation process:
- extensions(ListOfExtensions)
List of file-extensions to try. Default is ['']
. For each
extension, absolute_file_name/3 will first add the extension and then
verify the conditions imposed by the other options. If the condition
fails, the next extension of the list is tried. Extensions may be
specified both as '.ext' or plain 'ext'.
- access(Mode)
Imposes the condition access_file( File, Mode). Mode
is on of read, write, append, exist or
none. See also access_file/2.
- is_absolute_file_name( +File)
True if File specifies and absolute path-name. On Unix systems,
this implies the path starts with a `/'. For MicroSoft based systems
this implies the path starts with <letter>:. This predicate is
intended to provide platform-independent checking for absolute paths.
See also absolute_file_name/2 and prolog_to_os_filename/2.
- expand_file_name( +WildChart, -List)
Unify List with a sorted list of files or directories matching
WildChart. The normal Unix wildchart constructs `?
',
`*
', `[...]
' and `{...}
' are recognised. The
interpretation of `{...}
' is interpreted slightly different from
the C shell (csh(1)). The comma separated argument can be arbitrary
patterns, including `{...}
' patterns. The empty pattern is legal
as well: `{.pl,}
' matches either `.pl
' or the empty
string.
- prolog_to_os_filename( ?PrologPath, ?OsPath)
Converts between the internal Prolog pathname conventions and the
operating-system pathname conventions. The internal conventions are
Unix and this predicates is equivalent to =/2 (unify) on Unix systems.
On DOS systems it will change the directory-separator, limit the
filename length map dots, except for the last one, onto underscores.
- read_link( +File, -Link, -Target)
If File points to a symbolic link, unify Link with the
value of the link and Target to the file the link is pointing to.
Target points to a file, directory or non-existing entry in the
file system, but never to a link. Fails if File is not a link.
Fails always on systems that donot support symbolic links.
- tmp_file( +Base, -TmpName)
Create a name for a temporary file. Base is an identifier for
the category of file. The TmpName is guaranteed to be unique.
If the system halts, it will automatically remove all created temporary
files.
- chdir( +Path)
Change working directory to Path.
Next: User Toplevel Manipulation
Up: Built-In Predicates
Previous: Unix Interaction
Passani Luca
Tue Nov 14 08:58:33 MET 1995