Sync files

Syncing with the p4 sync command adds, updates, or deletes files in the client workspace to bring the workspace contents into agreement with the depot. If a file exists within a particular subdirectory in the depot, but that directory does not exist in the client workspace, the directory is created in the client workspace when you sync the file. If a file has been deleted from the depot, p4 sync deletes it from the client workspace.

Example   Sync files from the depot to a client workspace

The command below retrieves the most recent revisions of all files in the client view from the depot into the workspace. As files are synced, they are listed in the command output.

C:\bruno_ws> p4 sync
//Acme/dev/bin/bin.linux24x86/readme.txt#1 - added as c:\bruno_ws\dev\bin\bin.linux24x86\readme.txt
//Acme/dev/bin/bin.ntx86/glut32.dll#1 - added as c:\bruno_ws\dev\bin\bin.ntx86\glut32.dll
//Acme/dev//bin/bin.ntx86/jamgraph.exe#2 - added as c:\bruno_ws\dev\bin\bin.ntx86\jamgraph.exe
[...]
Note

You cannot sync files that are not in your workspace view. See Configure workspace views for more information.

To sync revisions of files prior to the latest revision in the depot, use revision specifiers. For example, to sync the first revision of Jamfile, which has multiple revisions, issue the following command:

p4 sync //Acme/dev/jam/Jamfile#1

To sync groups of files or entire directories, use wildcards. For example, to sync everything in and below the jam folder, issue the following command:

p4 sync //Acme/dev/jam/...

The Helix Core Server tracks which revisions you have synced. For maximum efficiency, Helix Core Server does not re-sync an already-synced file revision. To re-sync files you (perhaps inadvertently) deleted manually, specify the -f option when you issue the p4 sync command.

File names and operating systems

The names of files (and directories) might be lowercase, uppercase, or a mix of upper and lower case, such as such as readme, ReadMe, and README. Depending on the operating system of the Helix Core client and the operating system of the Helix Core Server, complications might occur when you sync files (or directories) if the same name has differences of case. To learn more, see Case sensitivity and multi-platform development in the Helix Core Server Administrator Guide.