This is documentation for Mathematica 7, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

DeleteDirectory

DeleteDirectory["dir"]
deletes the specified directory.
  • DeleteDirectory["dir"] deletes the directory dir only if it contains no files.
Create a directory:
Check the presence of the new directory:
Delete the directory:
The directory is no longer there:
Create a directory:
In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=
Check the presence of the new directory:
In[3]:=
Click for copyable input
Out[3]=
Delete the directory:
In[4]:=
Click for copyable input
The directory is no longer there:
In[5]:=
Click for copyable input
Out[5]=
New in 2