is a symbolic representation of a location in the local file system.


  • In File["path"], "path" specifies a possible path on the local file system. The path does not need to actually exist or refer to a file. »
  • File["path"] can use both absolute and relative paths. »
  • Information for a File may include the following properties:
  • "CreationDate"date when the file was created
    "LastAccessDate"time when the file was last accessed
    "LastModificationDate"time when the contents of the file were last modified
    "LastChangeDate"time when a file attribute was last changed
    "FileType"file type
    "ByteCount"file size in bytes
    "RawByteCount"how much space in bytes the file uses on disk
    "BlockCount"number of blocks the file uses
    "BlockSize"size of one block
    "FileAssociation"program associated with the file
    "UnixPermissionsCode" permissions in numeric form (e.g. 2774)
    "UnixPermissionsString"permissions in string form (e.g. "rwxrwsr--")
    "Device"name of the device on which the file lives.
    "UID"user ID
    "GID"group ID
    "SID"user's Security Identifier
    "OwnerName"owner of the file


open allclose all

Basic Examples  (2)

Get a snippet from a text file:

Without the File wrapper, the string itself would be used as data:

Formatting of a File object:

Scope  (3)

A File object need not point to an existing path:

Moreover, the path need not refer to a normal file:

Use File with an absolute path:

Use File with a relative path:

Properties & Relations  (2)

Each function will expand paths in a File object according to its own rules:

Get information about a File object:

Wolfram Research (2016), File, Wolfram Language function, (updated 2019).


Wolfram Research (2016), File, Wolfram Language function, (updated 2019).


Wolfram Language. 2016. "File." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2019.


Wolfram Language. (2016). File. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2024_file, author="Wolfram Research", title="{File}", year="2019", howpublished="\url{}", note=[Accessed: 25-July-2024 ]}


@online{reference.wolfram_2024_file, organization={Wolfram Research}, title={File}, year={2019}, url={}, note=[Accessed: 25-July-2024 ]}