Perforce Public Knowledge Base - Renaming Depot Directories
Reset Search



Renaming Depot Directories

« Go Back



Moving or renaming a depot directory


To move or rename a directory, you branch the existing directory into a new directory and delete the existing one. For example, to rename //depot/widgets to //depot/main/widgets issue the following commands:

p4 integ //depot/widgets/... //depot/main/widgets/...
p4 delete //depot/widgets/...
p4 submit

Make sure to submit the "integ" and the "delete" in the same changelist.

This series of commands marks the head revisions of files in //depot/widgets as deleted. To remove your //depot/widgets files and copy in the //depot/main/widgets files, you should do a p4 sync with your client view mapped to //depot/main/widgets

The complete history of the files in the new directory can be shown with p4 filelog -i and p4 changes -i.

Note:  Before renaming files, none of the files to be renamed should be opened for add/edit/delete/branch/integrate. The "integrate" command will only propagate changes from a submitted revision.  Local, not-yet-submitted edits in your workspace will not be propagated to the integrated file.

Also, you are unable to delete any opened source files in the directory that you are trying to rename. Attempting to delete a file that is already opened for edit generates an error. For example:

$ p4 delete main.c
//depot/test/main.c - can't delete (already opened for edit)

In order to have all source directory files renamed and all current edits propagated to the target, all opened files in that directory tree must either be submitted or reverted.

Note: If you want to move your current workspace edits to a new target directory, please consult KB Article #56: Branching Work in Progress.

Note: After you have renamed the depot directory, you must change any references to the directory name to reflect the new name so that all users can view and sync to files from the new directory. To avoid errors, check the following for references to the depot directory:

  • Protection tables
  • Client workspace specifications
  • Labels
  • Branch specifications
  • Triggers
  • Scripts that refer to the depot directory
Related Links



Was this article helpful?



Please tell us how we can make this article more useful.

Characters Remaining: 255