filelib

File utilities, such as wildcard matching of filenames

This module contains utilities on a higher level than the file
module.

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 fun() provided to fold_files/5 needs to be prepared to handle binary file names.

fold_files(Dir, RegExp, Recursive, Fun, AccIn) -> AccOut

The fold_files/5 function folds the function
Fun over all (regular) files F in the
directory Dir that match the regular expression RegExp
(see the re module for a description
of the allowed regular expressions).
If Recursive is true all sub-directories to Dir
are processed. The regular expression matching is done on just
the filename without the directory part.

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
fun() must be prepared to handle raw file names
(i.e. binaries). If the regular expression contains
codepoints beyond 255, it will not match file names that do
not conform to the expected character encoding (i.e. are not
encoded in valid UTF-8).