({{, (RefLink[CreateFile, paclet:ref/CreateFile])["file"]
creates a file with name file. }, {, (RefLink[CreateFile, paclet:ref/CreateFile])[] 
creates a file in the default area for temporary files on your computer system.}})

OpenersNotesSection(Spacer1)Details and Options

If "file" has no pathname separators, (RefLink[CreateFile, paclet:ref/CreateFile]) creates a file in your current working directory.

A relative path is interpreted with respect to the current working directory.

(RefLink[CreateFile, paclet:ref/CreateFile]) only creates the file; it does not open it.

The file created can subsequently be opened for reading or writing in binary or text mode.

(RefLink[CreateFile, paclet:ref/CreateFile]) returns the full name of the file it creates, and (RefLink[$Failed, paclet:ref/$Failed]) if it cannot create the file.

(RefLink[CreateFile, paclet:ref/CreateFile]) has attribute (RefLink[Listable, paclet:ref/Listable]).

(RefLink[CreateFile, paclet:ref/CreateFile])[] creates a file in the directory specified by the current value of (RefLink[$TemporaryDirectory, paclet:ref/$TemporaryDirectory]).

The default setting (RefLink[CreateIntermediateDirectories, paclet:ref/CreateIntermediateDirectories])->(RefLink[True, paclet:ref/True]) specifies that intermediate directories should be created as needed.

(RefLink[File, paclet:ref/File])["path"] may be used to specify a file name.

OpenersPrimaryExamplesSection(Spacer1)Examples  (3)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Create a file:

file=CreateFile[]

Check the presence of the new file:

FileExistsQ[file]

Delete the file:

DeleteFile[file]

The file is no longer there:

FileExistsQ[file]

OpenersExampleSection1(Spacer1)Scope  (1)

Create a file in the current directory:

file=File[CreateFile[File@"tempfile"]]

The file is present in the current directory:

FileExistsQ[FileNameJoin[{Directory[],"tempfile"}]]

Delete the file:

DeleteFile[file]

OpenersExampleSection3(Spacer1)Properties & Relations  (1)

(RefLink[CreateTemporary, paclet:ref/CreateTemporary])[] is essentially equivalent to the zero-argument (RefLink[CreateFile, paclet:ref/CreateFile])[]:

file1=CreateTemporary[]

file2=CreateFile[]

DeleteFile[{file1,file2}]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[DeleteFile, paclet:ref/DeleteFile])  ▪  (RefLink[RenameFile, paclet:ref/RenameFile])  ▪  (RefLink[CopyFile, paclet:ref/CopyFile])  ▪  (RefLink[CreateDirectory, paclet:ref/CreateDirectory])  ▪  (RefLink[$PathnameSeparator, paclet:ref/$PathnameSeparator])  ▪  (RefLink[LocalObject, paclet:ref/LocalObject])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Manipulating Files and Directories, paclet:tutorial/ManipulatingFilesAndDirectories])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Low-Level File Operations, paclet:guide/LowLevelFileOperations])}})}})