p4 move

Move (rename) a file from one location to another within the branch.


p4 [g-opts] move [-c change] [-f -n -k] [-t filetype] fromFileSpec toFileSpec
p4 [g-opts] move -r [-c change] [-n -k] fromFileSpec toFileSpec


The p4 move command takes a file already opened for edit or add and moves it to the destination provided.

An open file can be moved many times before it is submitted. Moving a file back to its original location undoes the pending move, leaving it open for edit. Using p4 revert on a moved file both undoes the move and reverts the unsubmitted content.


The p4 move command should only be used for intra-branch file rename or move, that is, renaming a file within the same directory, or between folders within the same directory tree. To learn how to restructure the depot by moving an entire branch, see the Knowledge Base article, "Renaming Depot Directories".


-c change

If a changelist number is provided, the files are opened in the numbered pending changelist.

-t filetype

If a filetype is specified, the file is reopened as the new filetype.


Force a move to an existing target file. The file must be synced, but not opened. The originating source file will no longer be synced to the workspace.

If you use p4 move -f, you will need to resolve the move before submitting the changelist.


Keep existing workspace files by bypassing the renaming in the client workspace. Use p4 move -k only in the context of reconciling work performed while disconnected from the Perforce service.

-r Rename existing files without altering content or type to a new target. This option allows the user to move files from the depot to a different location without opening the files first. This option performs a strict rename only. Therefore the -t and -f flags are not allowed, source files must not be already opened, and the targets must not already exist.


Preview the move that would be performed, without actually moving files.


See Global options.

Usage Notes

Can File Arguments Use Revision Specifier? Can File Arguments Use Revision Range? Minimal Access Level Required

fromFile: Yes
toFile: No


read access for fromFile
write access for toFile

  • Files must be open for add or open for edit before they can be moved.
  • To move and resolve a file that is open for edit but has been renamed at the head revision, you can use the -f option to force the move.


p4 move file1.c file2.c

Assuming that file1.c is open for add or edit, move file1.c to file2.c.

p4 move //depot/main/directory1/... //depot/main/directory2/...

Move open files from one directory to another within the same depot tree.