CreateFile["file"]
creates a file with name file.
creates a file in the default area for temporary files on your computer system.


CreateFile
CreateFile["file"]
creates a file with name file.
creates a file in the default area for temporary files on your computer system.
Details and Options

- If "file" has no pathname separators, CreateFile creates a file in your current working directory.
- A relative path is interpreted with respect to the current working directory.
- 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.
- CreateFile returns the full name of the file it creates, and $Failed if it cannot create the file.
- CreateFile has attribute Listable.
- CreateFile[] creates a file in the directory specified by the current value of $TemporaryDirectory.
- The default setting CreateIntermediateDirectories->True specifies that intermediate directories should be created as needed.
- With the setting OverwriteTarget->True, CreateFile truncates the existing file to zero size.
- File["path"] may be used to specify a file name.
Examples
open all close allBasic Examples (1)
Scope (1)
Properties & Relations (1)
CreateTemporary[] is essentially equivalent to the zero-argument CreateFile[]:
See Also
DeleteFile RenameFile CopyFile CreateDirectory $PathnameSeparator LocalObject $TemporaryDirectory
Function Repository: CreateRandomFile
Tech Notes
Related Guides
Text
Wolfram Research (2016), CreateFile, Wolfram Language function, https://reference.wolfram.com/language/ref/CreateFile.html (updated 2019).
CMS
Wolfram Language. 2016. "CreateFile." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2019. https://reference.wolfram.com/language/ref/CreateFile.html.
APA
Wolfram Language. (2016). CreateFile. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CreateFile.html
BibTeX
@misc{reference.wolfram_2025_createfile, author="Wolfram Research", title="{CreateFile}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/CreateFile.html}", note=[Accessed: 14-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_createfile, organization={Wolfram Research}, title={CreateFile}, year={2019}, url={https://reference.wolfram.com/language/ref/CreateFile.html}, note=[Accessed: 14-August-2025]}