
[;1m  read_file_info(File)[0m

  There is no documentation for read_file_info(File, [])

[;1m  read_file_info(File, Opts)[0m

[;;4mSince[0m:
  OTP R15B

  Retrieves information about a file. Returns [;;4m{ok, FileInfo}[0m if
  successful, otherwise [;;4m{error, Reason}[0m.

  [;;4mFileInfo[0m is a record [;;4mfile_info[0m, defined in the Kernel include
  file [;;4mfile.hrl[0m. Include the following directive in the module
  from which the function is called:

    -include_lib("kernel/include/file.hrl").

  The time type returned in [;;4matime[0m, [;;4mmtime[0m, and [;;4mctime[0m is
  dependent on the time type set in [;;4mOpts :: {time, Type}[0m as
  follows:

   • [;;4mlocal[0m - Returns local time.

   • [;;4muniversal[0m - Returns universal time.

   • [;;4mposix[0m - Returns seconds since or before Unix time epoch,
     which is 1970-01-01 00:00 UTC.

  Default is [;;4m{time, local}[0m.

  If the option [;;4mraw[0m is set, the file server is not called and only
  information about local files is returned. Note that this will
  break this module's atomicity guarantees as it can race with a
  concurrent call to [;;4mwrite_file_info/1,2[0m .

  This option has no effect when the function is given an I/O device
  instead of a file name. Use [;;4mopen/2[0m with the [;;4mraw[0m mode to obtain
  a file descriptor first.

  [;;4mNote[0m

    As file times are stored in POSIX time on most OS, it is
    faster to query file information with option [;;4mposix[0m.

  The record [;;4mfile_info[0m contains the following fields:

   • [;;4msize = [0m[;;4mnon_neg_integer/0[0m - Size of file in bytes.

   • [;;4mtype = device | directory | other | regular[0m - The type of
     the file. Can also contain [;;4msymlink[0m when returned from
     read_link_info/1,2.

   • [;;4maccess = read | write | read_write | none[0m - The current
     system access to the file.

   • [;;4matime = [0m[;;4mdate_time/0[0m [;;4m| [0m[;;4mnon_neg_integer/0[0m - The last time
     the file was read.

   • [;;4mmtime = [0m[;;4mdate_time/0[0m [;;4m| [0m[;;4mnon_neg_integer/0[0m - The last time
     the file was written.

   • [;;4mctime = [0m[;;4mdate_time/0[0m [;;4m| [0m[;;4mnon_neg_integer/0[0m - The
     interpretation of this time field depends on the operating
     system. On Unix, it is the last time the file or the [;;4minode[0m
     was changed. In Windows, it is the create time.

   • [;;4mmode = [0m[;;4mnon_neg_integer/0[0m - The file permissions as the sum
     of the following bit values:

      ￮ [;;4m8#00400[0m - read permission: owner

      ￮ [;;4m8#00200[0m - write permission: owner

      ￮ [;;4m8#00100[0m - execute permission: owner

      ￮ [;;4m8#00040[0m - read permission: group

      ￮ [;;4m8#00020[0m - write permission: group

      ￮ [;;4m8#00010[0m - execute permission: group

      ￮ [;;4m8#00004[0m - read permission: other

      ￮ [;;4m8#00002[0m - write permission: other

      ￮ [;;4m8#00001[0m - execute permission: other

      ￮ [;;4m16#800[0m - set user id on execution

      ￮ [;;4m16#400[0m - set group id on execution

     On Unix platforms, other bits than those listed above may be
     set.

   • [;;4mlinks = [0m[;;4mnon_neg_integer/0[0m - Number of links to the file
     (this is always 1 for file systems that have no concept of
     links).

   • [;;4mmajor_device = [0m[;;4mnon_neg_integer/0[0m - Identifies the file
     system where the file is located. In Windows, the number
     indicates a drive as follows: 0 means A:, 1 means B:, and so
     on.

   • [;;4mminor_device = [0m[;;4mnon_neg_integer/0[0m - Only valid for
     character devices on Unix. In all other cases, this field is
     zero.

   • [;;4minode = [0m[;;4mnon_neg_integer/0[0m - Gives the [;;4minode[0m number. On
     non-Unix file systems, this field is zero.

   • [;;4muid = [0m[;;4mnon_neg_integer/0[0m - Indicates the owner of the file.
     On non-Unix file systems, this field is zero.

   • [;;4mgid = [0m[;;4mnon_neg_integer/0[0m - Gives the group that the owner
     of the file belongs to. On non-Unix file systems, this field
     is zero.

  Typical error reasons:

   • [;;4meacces[0m - Missing search permission for one of the parent
     directories of the file.

   • [;;4menoent[0m - The file does not exist.

   • [;;4menotdir[0m - A component of the filename is not a directory.
     On some platforms, [;;4menoent[0m is returned instead.
