set_time_file(foo, [acess(Access)], )contains typo. Should be acess -> access.
|Did you know ...||Search Documentation:|
|library(filesex): Extended operations on files|
This module provides additional operations on files. This covers both more obscure and possible non-portable low-level operations and high-level utilities.
Using these Prolog primitives is typically to be preferred over using operating system primitives through shell/1 or process_create/3 because (1) there are no potential file name quoting issues, (2) there is no dependency on operating system commands and (3) using the implementations from this library is usually faster.
nowto indicate the current time. Defined options are:
link()) or removing (
Below are some example queries. The first retrieves the access-time, while the second sets the last-modified time to the current time.
?- set_time_file(foo, [access(Access)], ). ?- set_time_file(foo, , [modified(now)]).
With some limitations, these functions also work on Windows. First of all, the underlying filesystem must support links. This requires NTFS. Second, symbolic links are only supported in Vista and later.
domain_error(link_type, Type)if the requested link-type is unknown or not supported on the target OS.
?- relative_file_name('/home/janw/nice', '/home/janw/deep/dir/file', Path). Path = '../../nice'. ?- relative_file_name(Path, '/home/janw/deep/dir/file', '../../nice'). Path = '/home/janw/nice'.
Add a terminating
/ to get a path relative to a directory,
?- relative_file_name('/home/janw/deep/dir/file', './', Path). Path = 'deep/dir/file'.
|All||paths must be in canonical POSIX notation, i.e., using / to separate segments in the path. See prolog_to_os_filename/2.|
atom_concat(Directory, File, Path), but it ensures there is exactly one / between the two parts. Notes:
false), recurse into subdirectories
true(default), follow symbolic links.
error. Default is
warning. Errors notably happen if a directory is unreadable or a link points nowhere.
true(default), also return hidden files.
This predicate is safe against cycles introduced by symbolic links to directories.
The idea for a non-deterministic file search predicate comes from Nicos Angelopoulos.
-Modeor a plain Mode, which adds new permissions, revokes permissions or sets the exact permissions. Mode itself is an integer, a POSIX mode name or a list of POSIX mode names. Defines names are
svtxand all names defined by the regular expression
[ugo]*[rwx]*. Specifying none of "ugo" is the same as specifying all of them. For example, to make a file executable for the owner (user) and group, we can use:
?- chmod(myfile, +ugx).