Did you know ... | Search Documentation: |
Packs (add-ons) for SWI-Prolog |
Title: | Few extra predicates for traversing folders and simplifying work with file system |
---|---|
Rating: | Not rated. Create the first rating! |
Latest version: | 0.1.0 |
SHA1 sum: | f7a4eb6da1e19eb58edf3747348243d3640040aa |
Author: | Milan Unger http://milung.eu/ |
Home page: | https://github.com/milung/files_extra.git |
No reviews. Create the first review!.
Version | SHA1 | #Downloads | URL |
---|---|---|---|
0.1.0 | f7a4eb6da1e19eb58edf3747348243d3640040aa | 2 | https://github.com/milung/file_extras.git |
b8aa748b7284976e9da5d88d4e0c179fec3c0800 | 2 | https://github.com/milung/file_extras.git | |
d7b586a9e39d157f1842e3fb5a9b2d4c02214e76 | 35 | https://github.com/milung/file_extras.git |
Prolog module for simplifying some common operation on the file system (e.g. traversing folder structure)
file_extras
Calls call(Goal, Arg)
for each file or sub-directory in the
RootDirectory tree, recursively. The scan is the depth-first.
The argument Arg is one of
directory(Directory, Path)
where Directory is name of the directory without
the path and Path is path (from RootDirectory) to the directory itself,
including the Directory name. If the Goal fails then the complete content
of the directory is skipped.file(File, Path)
where File is name of the file without
the path and Path is path (from RootDirectory) to the file itself,
including the File name. The success or failure of the Goal is ignored.
Calls call(Goal, Arg, StatePrev, StateNext)
for each file or sub-directory in the
RootDirectory tree, recursively. The scan is the depth-first.
The argument Arg is one of
directory(Directory, Path)
where Directory is name of the directory without
the path and Path is path (from RootDirectory) to the directory itself,
including the Directory name. If the Goal fails then the complete content
of the directory is skipped.file(File, Path)
where File is name of the file without
the path and Path is path (from RootDirectory) to the file itself,
including the File name. The success or failure of the Goal is ignored.
The State0 is initial state and StateFinal is accumulated stated after scanning all directories and files for which the Goal succeeded. Files in directories where Goal failed for the directory level are skipped.
path_to_posix(+Path:atom, -Posix:atom)
is detSucceeds if Posix unifies with Path, given that backslashes in Path are replaced by forward slashes in Posix. Utility for windows paths, seems like multiple built-in predicates are sensitive to it.
To debug the module, load the debug.pl
file into prolog top.
Pack contains 4 files holding a total of 6.4K bytes.