How to sync to specific folder using command line in Perforce

35,829

Say the depot path is //depot/project/...

From the command line, do p4 sync //depot/project/fold1/fold2/...

(the "..." tells Perforce you want that folder and everything under it).

From P4V, right-click on the folder and choose "Get Latest Revision". It will only pull in the folder and everything underneath it.

Share:
35,829
Aman
Author by

Aman

Always keen to learn new concepts n even explore them

Updated on June 14, 2020

Comments

  • Aman
    Aman almost 4 years

    Suppose I have mapped my depot to client workspace as c:/perforce/project but now

    I want to sync all the files present in c:/perforce/project/fold1/fold2 folder.

    How can we do it, as the command p4 sync takes only file names and not folder.

  • Samwise
    Samwise almost 8 years
    You can also do this using local or relative paths, e.g. cd to c:\perforce\project and then "p4 sync fold1/fold2/..."
  • Aman
    Aman almost 8 years
    This is what I wanted. Thanks for pointing "..." tells Perforce you want that folder and everything under it. I was missing it. Can you also tell the command for getting Workspace directory and Workspace name.
  • tkosinski
    tkosinski almost 7 years
    Something like "p4 sync C:/mydir/myfolder/..." will work IF that path is under your default p4 workspace setting. (Since I typically have several workspaces going, I use .p4config just to make sure I'm in the right place and syncing what I want to sync).
  • Ciasto piekarz
    Ciasto piekarz almost 4 years
    this seems to be accepting file paths only not folder paths, I tried folder path and I get message - no such files(s).
  • tkosinski
    tkosinski almost 4 years
    Yes, P4 tracks things by file, so if you don't have any files in a folder you could get that message.