File

File["path"]

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

Details

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

Examples

open allclose all

Basic Examples  (3)

Load a string template from disk:

In[1]:=
Click for copyable input
Out[1]=

Get a snippet from a text file:

In[1]:=
Click for copyable input
Out[1]=

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

In[2]:=
Click for copyable input
Out[2]=

Formatting of a File object:

In[1]:=
Click for copyable input
Out[1]=

Scope  (1)

Properties & Relations  (1)

See Also

FileNames  FindFile  URL  LocalObject

Introduced in 2016
(11.0)