DeleteFile

DeleteFile["file"]

deletes a file.

DeleteFile[{"file1","file2",}]

deletes a list of files.

Details

  • DeleteFile returns Null if it succeeds in deleting files, and $Failed if it fails.
  • File["path"] may be used to specify a file name.

Examples

open allclose all

Basic Examples  (1)

Copy a file and copy it into the new directory:

The file is there:

Delete the file:

The file is no longer there:

Scope  (1)

Copy the file specified as a File object:

Properties & Relations  (2)

Remove a local object:

Remove a persistent object:

Alternatively, use Remove on the persistent symbol:

Wolfram Research (1991), DeleteFile, Wolfram Language function, https://reference.wolfram.com/language/ref/DeleteFile.html (updated 2016).

Text

Wolfram Research (1991), DeleteFile, Wolfram Language function, https://reference.wolfram.com/language/ref/DeleteFile.html (updated 2016).

CMS

Wolfram Language. 1991. "DeleteFile." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/DeleteFile.html.

APA

Wolfram Language. (1991). DeleteFile. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DeleteFile.html

BibTeX

@misc{reference.wolfram_2024_deletefile, author="Wolfram Research", title="{DeleteFile}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/DeleteFile.html}", note=[Accessed: 24-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_deletefile, organization={Wolfram Research}, title={DeleteFile}, year={2016}, url={https://reference.wolfram.com/language/ref/DeleteFile.html}, note=[Accessed: 24-November-2024 ]}