dirent() = reference()
Directory reference.
dirname() = filename()
Directory name.
abstract datatype: dtype()
Indicates the file type.
device
directory
symlink
regular
other
undefined
filename() = file:name()
File name.
abstract datatype: posix_error()
Common POSIX errors:
enoent
Path
is an empty string.eacces
emfile
enfile
enomem
enotdir
Path
is not a directory.controlling_process/2 | Set controlling affinity. |
opendir/1 | Opens the given Path . |
readdir/1 | Lists all files in DirRef , except files with raw
names. |
readdir_all/1 | Lists all files in DirRef , including files with raw names, returning
also the file type. |
readdir_raw/1 | Lists raw filenames in DirRef , returning also the file type. |
readdir_type/1 | Lists all files in DirRef , except files with raw
names, returning also the file type. |
controlling_process(DirRef, Pid) -> ok
Set controlling affinity.
Once created,DirRef
is associated to the calling process and reading
functions should be executed by the same process. If passing to another
process is required, then this function should be called from the process
owner, delegating control to another process indicated by Pid
.
opendir(Path) -> DirRef | {error, Reason}
Opens the given Path
. Returns {ok, DirRef}
if successful, otherwise
{error, Reason}
.
readdir(DirRef) -> F | finished | {error, Reason}
Lists all files in DirRef
, except files with raw
names. Returns F
while iterating over the directory or finished
when
done.
If the filename is a binary()
with characters coded in ISO Latin-1 and the
VM was started with parameter +fnue
, the function returns
{error, {no_translation, RawName}}
.
If called by any other process than the current controlling process,
{error, not_owner}
is returned.
readdir_all(DirRef) -> {F, Dtype} | finished | {error, Reason}
Lists all files in DirRef
, including files with raw names, returning
also the file type.
Returns {F, Dtype}
or finished
when done. Dtype
can be used to avoid
making a second call to file:read_file_info/1,2
if the filesystem has
support to it in the system readdir
. If the filesystem does not have
support, Dtype
will be always undefined
.
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 F
will represent a raw filename (that is,
binary).
If called by any other process than the current controlling process,
{error, not_owner}
is returned.
readdir_raw(DirRef) -> {F, Dtype} | finished | {error, Reason}
Lists raw filenames in DirRef
, returning also the file type.
No Unicode translation is made on the filename, and it is returned in raw format (binary).
Returns {F, Dtype}
or finished
when done. Dtype
can be used to avoid
making a second call to file:read_file_info/1,2
if the filesystem has
support to it in the system readdir
. If the filesystem does not have
support, Dtype
will be always undefined
.
readdir_type(DirRef) -> {F, Dtype} | finished | {error, Reason}
Lists all files in DirRef
, except files with raw
names, returning also the file type.
Returns {F, Dtype}
or finished
when done. Dtype
can be used to
avoid making a second call to file:read_file_info/1,2
if the filesystem
has support to it in the system readdir
. If the filesystem does not have
support, Dtype
will be always undefined
.
If the filename is a binary()
with characters coded in ISO Latin-1 and the
VM was started with parameter +fnue
, the function returns
{error, {no_translation, RawName}}
.
If called by any other process than the current controlling process,
{error, not_owner}
is returned.
Generated by EDoc