RenameDirectory

RenameDirectory["dir1", "dir2"]
renames the directory to .

DetailsDetails

  • must already exist; must not.
  • RenameDirectory sets the modification date for to be the same as for .
  • RenameDirectory returns the full new directory name, or $Failed if the directory cannot be renamed.

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]=

Rename the directory:

In[5]:=
Click for copyable input
In[6]:=
Click for copyable input
Out[6]=
In[7]:=
Click for copyable input
Out[7]=
In[8]:=
Click for copyable input
Out[8]=

Delete the directory:

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