Did you know ... Search Documentation:
Pack dpath -- prolog/dpath.pl
PublicShow source

Traverses directory structure and backtracks when necessary.

Example:

  ?- file(A/B),atom_concat(t,_,B).

True when A is unified to a subdirectory and B is unified to a filename that begins with a letter t.

 file(?Pathterm) is nondet
Check if the file exists or search for a file that matches.

Example:

?- file('c:'/A/'explorer.exe').
A = 'Windows';
false.
Errors
- Throws errors only when debug topic dpath(exceptions) is true
 filetype(?Pathterm_with_extension) is nondet
Check if the file exists or search for a file that matches. Uses the file base name and extension. Needs a dpath-qualifier because of @see ./3

Example:

?- dpath:filetype('c:'/windows/A.exe).
A = bfsvc;
A = explorer;
Errors
- throws errors only when debug topic dpath(exceptions) is true
 dir(?PathTerm) is nondet
Check if directory exists or search for a matching directory.

True if PathTerm is unified to a existing path to a directory

Example:

?- dir('c:'/windows/B/C).
B = appcompat,
C = appraiser ;
B = appcompat,
C = 'Programs'
Errors
- throws errors only when debug topic dpath(exceptions) is true
 pathterm_atom(++PathTerm, -Res) is det
Res is a atom from a path term Path must contain only ground variables

Example: == pathterm_atom(k/l/m/a.b,'k/l/m/a.b'). ==