Go to the first, previous, next, last section, table of contents.


File name manipulation

Author(s): Daniel Cabeza, Angel Fernandez Pineda.

Version: 1.11#222 (2004/5/24, 13:8:7 CEST)

Version of last change: 1.3#51 (1999/9/9, 16:28:44 MEST)

This library provides some small utilities to handle file name syntax.

Usage and interface (filenames)

Documentation on exports (filenames)

PREDICATE: no_path_file_name/2:

This predicate will extract the last item (usually the file name) from a given path.

The first argument must be instantiated to a string or atom. Whenever the first argument is an atom, the second argument will be an atom. Whenever the first argument is a string, the second argument will be a string.

This predicate will fail under any of the following conditions:

Those are the most usual usages of no_path_file_name/2:

?- no_path_file_name_("/home/nexusV/somefile.txt",K).

K = "somefile.txt" ? 

yes
?- no_path_file_name('/home/nexusV/somefile.txt',K).

K = 'somefile.txt' ? 

yes
?- 

Usage: no_path_file_name(Path, FileName)

PREDICATE: file_name_extension/3:

This predicate may be used in two ways:

Any other usage of file_name_extension/3 will cause the predicate to fail. Notice that valid arguments are accepted both as atoms or strings.

Usage: file_name_extension(FileName, BaseName, Extension)

PREDICATE: basename/2:

basename(FileName, BaseName)

BaseName is FileName without extension. Equivalent to file_name_extension(FileName,BaseName,_). Useful to extract the base name of a file using functional syntax.

PREDICATE: extension/2:

extension(FileName, Extension)

Extension is the extension (suffix) of FileName. Equivalent to file_name_extension(FileName,_,Extension). Useful to extract the extension of a file using functional syntax.


Go to the first, previous, next, last section, table of contents.