is an option for DeleteDirectory that specifies whether the contents of directories should automatically be deleted.


DeleteContents
is an option for DeleteDirectory that specifies whether the contents of directories should automatically be deleted.
Details

- With the default setting DeleteContents->False, DeleteDirectory will only delete directories that contain no files.
Examples
Basic Examples (1)
List of files in the directory:
The contents of the directory cannot be deleted:

Use DeleteContents->True to automatically delete the contents:
See Also
History
Introduced in 1991 (2.0)
Text
Wolfram Research (1991), DeleteContents, Wolfram Language function, https://reference.wolfram.com/language/ref/DeleteContents.html.
CMS
Wolfram Language. 1991. "DeleteContents." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/DeleteContents.html.
APA
Wolfram Language. (1991). DeleteContents. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DeleteContents.html
BibTeX
@misc{reference.wolfram_2025_deletecontents, author="Wolfram Research", title="{DeleteContents}", year="1991", howpublished="\url{https://reference.wolfram.com/language/ref/DeleteContents.html}", note=[Accessed: 18-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_deletecontents, organization={Wolfram Research}, title={DeleteContents}, year={1991}, url={https://reference.wolfram.com/language/ref/DeleteContents.html}, note=[Accessed: 18-August-2025]}