renames the directory dir1 to dir2.


  • dir1 must already exist; dir2 must not.
  • RenameDirectory sets the modification date for dir2 to be the same as for dir1.
  • RenameDirectory returns the full new directory name, or $Failed if the directory cannot be renamed.
  • File["dir"] may be used to specify a directory name.


open allclose all

Basic Examples  (1)

Copy a directory:

List of files in the directory:

Rename the directory:

Delete the directory:

Scope  (1)

Rename a directory specified by the File object:

Introduced in 1991
Updated in 2016