This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
 Documentation / Mathematica / Built-in Functions / System Interface / File System  /
DeleteDirectory

  • DeleteDirectory[" dir "] deletes the specified directory.
  • DeleteDirectory[" dir ", DeleteContents -> True] deletes dir and all files and directories that it contains.
  • DeleteDirectory[" dir "] deletes the directory dir only if it contains no files.
  • DeleteDirectory returns Null if it succeeds in deleting a directory, and $Failed if it fails.
  • See the Mathematica book: Section 2.11.6.
  • See also: CreateDirectory, DeleteFile.