({{, (RefLink[File, paclet:ref/File])["path"] 
is a symbolic representation of a location in the local file system. }})

OpenersNotesSection(Spacer1)Details

In (RefLink[File, paclet:ref/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.

(RefLink[File, paclet:ref/File])["path"] can use both absolute and relative paths.

(RefLink[Information, paclet:ref/Information]) for a (RefLink[File, paclet:ref/File]) may include the following properties:

OpenersPrimaryExamplesSection(Spacer1)Examples  (6)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Load a string template from disk:

StringTemplate[File["Examples/String/url.txt"]]

Get a snippet from a text file:

Snippet[File["ExampleData/classification.tsv"]]

Without the (RefLink[File, paclet:ref/File]) wrapper, the string itself would be used as data:

Snippet["ExampleData/classification.tsv"]

Formatting of a (RefLink[File, paclet:ref/File]) object:

File[$InstallationDirectory]

OpenersExampleSection1(Spacer1)Scope  (1)

A (RefLink[File, paclet:ref/File]) object need not point to an existing path:

file = File[FileNameJoin[{$TemporaryDirectory,"tempname"}]]

FileExistsQ[file]

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

CreateDirectory[file]

DirectoryQ[file]

DeleteDirectory[file]

OpenersExampleSection3(Spacer1)Properties & Relations  (2)

Each function will expand paths in a (RefLink[File, paclet:ref/File]) object according to its own rules:

FindFile[File["ExampleData/classification.tsv"]]

ExpandFileName[File["ExampleData/classification.tsv"]]

Get information about a (RefLink[File, paclet:ref/File]) object:

file=File[FindFile["ExampleData/Collatz.m"]]

Information[file]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[FileNames, paclet:ref/FileNames])  ▪  (RefLink[FindFile, paclet:ref/FindFile])  ▪  (RefLink[URL, paclet:ref/URL])  ▪  (RefLink[LocalObject, paclet:ref/LocalObject])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Files, paclet:guide/Files])}, {▪(RefLinkPlain[File Operations, paclet:guide/FileOperations])}, {▪(RefLinkPlain[Operations on File Names, paclet:guide/OperationsOnFileNames])}})}})