BUILT-IN MATHEMATICA SYMBOL

DeleteContents

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

DetailsDetails

ExamplesExamplesopen allclose all

Basic Examples (1)Basic Examples (1)

Copy a directory:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
In[3]:=
Click for copyable input
Out[3]=

List of files in the directory:

In[4]:=
Click for copyable input
Out[4]=

The contents of the directory cannot be deleted:

In[5]:=
Click for copyable input
Out[5]=

Use DeleteContents->True to automatically delete the contents:

In[6]:=
Click for copyable input

The directory is no longer there:

In[7]:=
Click for copyable input
Out[7]=
New in 2
New to Mathematica? Find your learning path »
Have a question? Ask support »