RenameFile

RenameFile[file1,file2]

renames file1 to file2.

Details and Options

  • file1 must already exist; file2 must not.
  • RenameFile sets the modification date for file2 to be the same as for file1.
  • RenameFile returns the full new file name, or $Failed if the file cannot be renamed.
  • RenameFile works on cloud objects, changing their cloud file names but not their UUIDs.
  • RenameFile works on local objects.
  • Files can be specified either using "path" or File["path"].
  • RenameFile has the following option:
  • OverwriteTargetFalsewhether to overwrite if the target file already exists

Examples

open allclose all

Basic Examples  (1)

Copy a file:

Rename the file:

Import the renamed file:

Delete the file:

Scope  (2)

Rename a file specified by the File object:

RenameFile works on local objects:

Introduced in 1991
 (2.0)
 |
Updated in 2014
 (10.0)
2016
 (11.0)
2020
 (12.1)