This module contains utilities on a higher level than the
This module does not support "raw" filenames (that is, files whose names do not comply with the expected encoding). Such files are ignored by the functions in this module.
For more information about raw filenames, see the
Functionality in this module generally assumes valid input and
does not necessarily fail on input that does not use a valid
encoding. You can validate the encoding of a filename using
File operations used to accept filenames containing null characters (integer value zero). This caused the name to be truncated at the first null character. Filenames containing null characters inside the filename are now rejected and will cause primitive file operations fail.
Currently null characters at the end of the filename will be accepted by primitive file operations. Such filenames are however still documented as invalid. The implementation will also change in the future and reject such filenames.
Ensures that all parent directories for the specified file or
directory name
Returns
Returns the size of the specified file.
Folds function
If Unicode filename translation is in effect and the file
system is transparent, filenames that cannot be
interpreted as Unicode can be encountered, in which case the
For more information about raw filenames, see the
Returns
Returns
Returns
Returns the date and time the specified file or directory was last
modified, or
Returns a list of all files that match Unix-style wildcard string
The wildcard string looks like an ordinary filename, except that the following "wildcard characters" are interpreted in a special way:
Matches one character.
Matches any number of characters up to the end of the filename, the next dot, or the next slash.
Two adjacent
Matches any of the characters listed. Two characters
separated by a hyphen 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 match. Matching is case-sensitive, for example, "a" does not match "A".
Notice 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
filelib:wildcard("lib/*/src/*.?rl")
filelib:wildcard("lib/*/src/*.{erl,hrl}")
To find all
filelib:wildcard("lib/*/{src,include}/*.hrl").
To find all
filelib:wildcard("lib/*/{src,include}/*.{erl,hrl}")
To find all
filelib:wildcard("lib/**/*.{erl,hrl}")
Same as
Looks for a file of the given name by applying suffix rules to
the given directory path. For example, a rule
If
Equivalent to
Applies file extension specific rules to find the source file for
a given object file relative to the object directory. For example,
for a file with the extension
If