From 68d53c01b0b8e9a007a6a30158c19e34b2d2a34e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 18 May 2016 15:53:35 +0200 Subject: Update STDLIB documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Language cleaned up by the technical writers xsipewe and tmanevik from Combitech. Proofreading and corrections by Björn Gustavsson and Hans Bolinder. --- lib/stdlib/doc/src/filelib.xml | 184 +++++++++++++++++++++-------------------- 1 file changed, 95 insertions(+), 89 deletions(-) (limited to 'lib/stdlib/doc/src/filelib.xml') diff --git a/lib/stdlib/doc/src/filelib.xml b/lib/stdlib/doc/src/filelib.xml index 3ad159a66d..7c6380ce28 100644 --- a/lib/stdlib/doc/src/filelib.xml +++ b/lib/stdlib/doc/src/filelib.xml @@ -28,19 +28,23 @@ 1 Kenneth Lundin - 03-01-21 + 2003-01-21 A - filelib.sgml + filelib.xml filelib - File utilities, such as wildcard matching of filenames + File utilities, such as wildcard matching of filenames. + -

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

-

This module does not support "raw" file names (i.e. files whose names - do not comply with the expected encoding). Such files will be ignored - by the functions in this module.

-

For more information about raw file names, see the file module.

+

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

+ +

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 + file module.

@@ -61,93 +65,99 @@ - Ensure that all parent directories for a file or directory exist. + Ensure that all parent directories for a file or directory + exist. -

The ensure_dir/1 function ensures that all parent - directories for the given file or directory name Name +

Ensures that all parent directories for the specified file or + directory name Name exist, trying to create them if necessary.

Returns ok if all parent directories already exist - or could be created, or {error, Reason} if some parent - directory does not exist and could not be created for some - reason.

+ or can be created. Returns {error, Reason} if + some parent directory does not exist and cannot be created.

+ - Return the size in bytes of the file. + Return the size in bytes of a file. -

The file_size function returns the size of the given file.

+

Returns the size of the specified file.

+ Fold over all files matching a regular expression. -

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).

- -

For more information about raw file names, see the - file module.

+

Folds function Fun over all (regular) files + F in directory Dir that match + the regular expression RegExp (for a description + of the allowed regular expressions, + see the re module). + If Recursive is true, all subdirectories + to Dir + are processed. The regular expression matching is only done on + the filename without the directory part.

+

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

+

For more information about raw filenames, see the + file module.

+ - Test whether Name refer to a directory or not + Test whether Name refers to a directory. -

The is_dir/1 function returns true if Name - refers to a directory, and false otherwise.

+

Returns true if Name + refers to a directory, otherwise false.

+ - Test whether Name refer to a file or directory. + Test whether Name refers to a file or directory. + -

The is_file/1 function returns true if Name - refers to a file or a directory, and false otherwise.

+

Returns true if Name + refers to a file or a directory, otherwise false.

+ - Test whether Name refer to a (regular) file. + Test whether Name refers to a (regular) file. -

The is_regular/1 function returns true if Name - refers to a file (regular file), and false otherwise.

+

Returns true if Name + refers to a (regular) file, otherwise false.

+ - Return the local date and time when a file was last modified. + Return the local date and time when a file was last modified. + -

The last_modified/1 function returns the date and time the - given file or directory was last modified, or 0 if the file - does not exist.

+

Returns the date and time the specified file or directory was last + modified, or 0 if the file does not exist.

+ Match filenames using Unix-style wildcards. -

The wildcard/1 function returns a list of all files - that match Unix-style wildcard-string Wildcard.

+

Returns a list of all files that match Unix-style wildcard string + Wildcard.

The wildcard string looks like an ordinary filename, except - that certain "wildcard characters" are interpreted in a special - way. The following characters are special: -

+ that the following "wildcard characters" are interpreted in a special + way:

? @@ -160,14 +170,14 @@ ** -

Two adjacent *'s used as a single pattern will - match all files and zero or more directories and subdirectories.

+

Two adjacent * used as a single pattern match + all files and zero or more directories and subdirectories.

[Character1,Character2,...]

Matches any of the characters listed. Two characters - separated by a hyphen will match a range of characters. - Example: [A-Z] will match any uppercase letter.

+ separated by a hyphen match a range of characters. + Example: [A-Z] matches any uppercase letter.

{Item,...} @@ -175,49 +185,45 @@

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:

+ 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 .beam files in all applications, the following - line can be used:

+ top of an Erlang/OTP installation.

+

To find all .beam files in all applications, use the + following line:

- filelib:wildcard("lib/*/ebin/*.beam"). -

To find either .erl or .hrl in all applications - src directories, the following

+filelib:wildcard("lib/*/ebin/*.beam"). +

To find .erl or .hrl in all applications src + directories, use either of the following lines:

- filelib:wildcard("lib/*/src/*.?rl") -

or the following line

+filelib:wildcard("lib/*/src/*.?rl") - filelib:wildcard("lib/*/src/*.{erl,hrl}") -

can be used.

-

To find all .hrl files in either src or include - directories, use:

+filelib:wildcard("lib/*/src/*.{erl,hrl}") +

To find all .hrl files in src or include + directories:

- filelib:wildcard("lib/*/{src,include}/*.hrl"). +filelib:wildcard("lib/*/{src,include}/*.hrl").

To find all .erl or .hrl files in either - src or include directories, use:

+ src or include directories:

- filelib:wildcard("lib/*/{src,include}/*.{erl,hrl}") -

To find all .erl or .hrl files in any - subdirectory, use:

+filelib:wildcard("lib/*/{src,include}/*.{erl,hrl}") +

To find all .erl or .hrl files in any subdirectory:

- filelib:wildcard("lib/**/*.{erl,hrl}") +filelib:wildcard("lib/**/*.{erl,hrl}")
+ - Match filenames using Unix-style wildcards starting at a specified directory. + Match filenames using Unix-style wildcards starting at a + specified directory. -

The wildcard/2 function works like wildcard/1, - except that instead of the actual working directory, Cwd - will be used.

+

Same as wildcard/1, + except that Cwd is used instead of the working + directory.

-- cgit v1.2.3