Perforce – How to update depot on one workspace and transfer those updates to another workspace without re-downloading?

Oct 16th, 2016 | By | Category: Technology, Windows

So here’s the situation.. You have one computer with a crazy fast connection and another computer with a slow connection.. Or perhaps you have one server that is crazy cheap to run and another that is crazy expensive to run.. The idea would be that, for whatever reason, you want to download and update your perforce depots on the faster or cheaper machine and then transfer those updates over to the slower or more expensive server to do your business on.  The problem with perforce however is that it doens’t want you to do this easily, not through the gui at least so you have to dive into the command line and use a command called p4 sync -k.


Before be do the sync I am assuming that you already have your project fully downloaded and you have a workspace pointing at the it.   So in our hypothetical situation the steps leading up to below would have been something like this:

  1. I’ve logged into the server on one computer
  2. I already had or created a workspace for the depot I wanted to download(or already downloaded)
  3. I downloaded the latest of my depot to folder e:\transfer\project
    1. Meaning my workspace root is e:\transfer\project
      1. You can confirm this by right clicking on the workspace in the workspaces tab( view/workspaces or ctrl+5) and looking at what the workspace root is
  4. I ejected the thumb drive or whatever e: is and plugged it into my new computer
  5. On this new computer I also connected to the perforce server with my credentials and created a new workspace(lets pretend that we called it projectwkspace2), pointing it at e:\transfer\project , double checking that my workspace root points to the exact same folder on both machines
    1. Obviously if you copied the contents of the project from e:\transfer\project to c:\project it would be fine to point this new workspace at c:\project


Now assuming you’ve done all of the above let’s set all of our environment variables in the command line with the following commands:


  • Pretty important for the server to know how you are and to let you login.  So open up a command prompt and type:
    • #p4 set P4USER=YourUserName


  • Next you need to tell it your server address and port.
    • #p4 set P4PORT=tcp:your.server.url.or.IP:1666 (or whatever your port number is)

Now that those two are set you can login with

  • #p4 login
    • It will ask you for the password for the user specified above, enter it and you will be logged in


  • Finally you need to set your workspace so it knows what to sync up with.
    • #P4 set P4CLIENT=ExactAndFullWorkSpaceName
      • projectwkspace2 in the example above


There ya go, all set for the sync, now just go into the root folder(cd c:\project or whatever the path to your project is) of the depot or whatever folder you want to sync from and type:

#p4 sync -k

It will spew hundreds or thousands of lines for all of the files it is syncing and once after that yoou can restart your P4V client, switch to the workspace that you just synced and you’ll be good to go.

Note: If there have been updates to the depot after you last updated locally they won’t be synced over and you’ll have to do a force sync from the slow or expensive machine in order to get them over if you run this sync -k after they’ve come in.


  1. I pull all updates on my fast machine.
  2. I copy files onto my USB stick, go over to my slow computer, load everything up
  3. In between my pulling the updates, copying the files over and loading them on to the second machine a developer commits 500MB of new files.
  4. I run my sync -k and then load up PV4 only to see that there is a new update in the history that I don’t have
  5. I right click on the update, click get revision and it tells me ‘no files updated’.
  6. The only way to get these updates is to do a force which then pulls a ton of files down kind of defeating the purpose of this exerciese.

So make doubly sure you are up to date before you start copying those files over.

Tags: , , , ,

Leave a Comment