This module contains utilities on a higher level than the
The module supports Unicode file names, so that it will match against regular expressions given in Unicode and that it will find and process raw file names (i.e. files named in a way that does not confirm to the expected encoding).
If the VM operates in Unicode file naming mode on a machine with transparent file naming, the
For more information about raw file names, see the
filename() = string() | atom() | DeepList | RawFilename
DeepList = [char() | atom() | DeepList]
RawFilename = binary()
If VM is in unicode filename mode, string() and char() are allowed to be > 255.
RawFilename is a filename not subject to Unicode translation, meaning that it
can contain characters not conforming to the Unicode encoding expected from the
filesystem (i.e. non-UTF-8 characters although the VM is started in Unicode
filename mode).
dirname() = filename()
The
Returns
The
The
If Unicode file name translation is in effect and the file
system is completely transparent, file names that cannot be
interpreted as Unicode may be encountered, in which case the
For more information about raw file names, see the
The
The
The
The
The
The wildcard string looks like an ordinary filename, except that certain "wildcard characters" are interpreted in a special way. The following characters are special:
Matches one character.
Matches any number of characters up to the end of the filename, the next dot, or the next slash.
Matches any of the characters listed. Two characters
separated by a hyphen will match a range of characters.
Example:
Alternation. Matches one of the alternatives.
Other characters represent themselves. Only filenames that have exactly the same character in the same position will match. (Matching is case-sensitive; i.e. "a" will not match "A").
Note that multiple "*" characters are allowed (as in Unix wildcards, but opposed to Windows/DOS wildcards).
Examples:
The following examples assume that the current directory is the top of an Erlang/OTP installation.
To find all
filelib:wildcard("lib/*/ebin/*.beam").
To find either
filelib:wildcard("lib/*/src/*.?rl")
or the following line
filelib:wildcard("lib/*/src/*.{erl,hrl}")
can be used.
To find all
filelib:wildcard("lib/*/{src,include}/*.hrl").
To find all
filelib:wildcard("lib/*/{src,include}/*.{erl,hrl}")
The