File "files"
This Prolog text provides file system access. The natively
implemented predicates are delete_file/1, remove_directory/1,
make_directory/1 and directory_files/2. These predicates work with
regular and directory file system entries. Their existence and
type can be checked with the core predicate file_property/2, since
it is silent for non-existent entries.
There are currently no predicates that can randomly access and/or
modify the content of streams. For bulk stream transfer we provide
the copy file conveniences, that work for both text and binary
streams. The predicate copy_time/2, since it only deals with meta
information, also works for both text and binary streams.
The following file predicates are provided:
- delete_file(F):
- The predicate succeeds. As a side effect the file F is
deleted. If the effect cannot be produced, the predicate will
throw an exception.
- remove_directory(F):
- The predicate succeeds. As a side effect the directory F is
removed. If the effect cannot be produced, the predicate will
throw an exception.
- make_directory(F):
- The predicate succeeds. As a side effect the directory F is
created. If the effect cannot be produced, the predicate will
throw an exception.
- directory_files(F, L):
- The predicate succeeds in L with the file and directory
entries of the directory F. If the list cannot be produced, the
predicate will throw an exception.
copy_text(A, B): - copy_text(A, B, O):
- The predicate succeeds. As side effect it copies the file A
into the file B. An already ex-isting file B is silently
overwritten. The ternary predicate allows specifying copy
file options. The following copy file options are
supported:
- append(B): B is the file append flag, default is false.
- copy_binary(A, B):
- copy_binary(A, B, O):
- The predicate succeeds. As side effect it copies the file A
into the file B. An already ex-isting file B is silently
overwritten. The ternary predicate allows specifying copy
file options.
- copy_time(A, B):
- copy_time(A, B, O):
- The predicate succeeds. As side effect it copies the last
modified date from file A to the last modified date of file B.
The ternary predicate allows specifying copy time options. The
following copy time options are supported:
update(B): B is the time update flag, default is false.