MOVE

Moves files and renames them to the destination and renames directories. See ROBOCOPYROBOCOPY for moving directories and directory structures.

Syntax to move one or more files (with the option to rename them at the destination):

MOVE [/Y | /-Y] [drive:][path]filename[,...] destination

Where:

  • /Y - Does not require confirmation to overwrite files.
  • /-Y - Requires confirmation to overwrite files.
  • [drive:][path]filename - Specifies path and name of the file to move.
  • destination - Specifies the path of the directory to move the file(s) to; if only one source file is specified, the name of the destination file can also be specified, renaming it.

The default option is /Y if the command is run from the command prompt, otherwise if it is run from a batch script the default option is /-Y.

By setting the COPYCMD environment variable you can specify /Y as the default option, which can be disabled using /-Y, see XCOPYXCOPY.

Example: Move the file C:\trippi\troppi\troppa\trippa.mp3 to the path C:\v.mp3:

move "C:\trippi\troppi\troppa\trippa.mp3" "C:\v.mp3"

 

Syntax to rename a directory:

MOVE [/Y | /-Y] [drive:][path]dirname1 dirname2

Where:

  • /Y - Does not require confirmation to overwrite files.
  • /-Y - Requires confirmation to overwrite files.
  • [drive:][path]dirname1 - Specifies the directory to rename.
  • dirname2 - Specifies the new name to give to the specified directory.

As before, the default option is /Y if the command is run from a command prompt, otherwise if it is run from a batch script the default option is /-Y. You can also set the COPYCMD environment variable.

Example: Rename the directory C:\all\none to C:\all\idk (you can't change the path):

move "C:\all\none" "idk"

Comments