CopyDirectory

CopyDirectory["dir1","dir2"]
copies the directory dir1 to dir2.

DetailsDetails

  • dir1 must already exist; dir2 must not.
  • CopyDirectory copies all the files in dir1 to dir2.
  • CopyDirectory sets the modification dates for dir2 and for all the files in it to be the same as those for dir1.
  • CopyDirectory returns the full name of the directory it copies to, and $Failed if it cannot complete the copy.
  • Directories can be specified either using "path" or File["path"].

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

Delete the directory:

In[5]:=
Click for copyable input

The directory is no longer there:

In[6]:=
Click for copyable input
Out[6]=
Introduced in 1991
(2.0)
| Updated in 2016
(11.0)