Use the p4 sizes command:
- The number of files returned by the p4 sizes command can give you an idea about the impact of the workspace on the size of the db.have table (one record per file).
- The total file size returned by the p4 sizes command can give you an idea about the volume of data transferred between the server and the client.
p4 -c workspace -H workspace_host sizes -s @workspace
This will produce output similar to:
@workspace 2386 files 36954596 bytes
Note: The above command will update the workspace access time. To prevent this, enter the command using the workspace file specification:
p4 -c workspace -H workspace_host sizes -s //workspace/...
Unlike the first command, the above command applies to the scope of the workspace view, thus it only gives you an estimate of the size of a workspace (all the files may not have been synced). For example, the output for the same workspace might look like:
//workspace/... 2397 files 23431271 bytes
There are more files on the client than the server (files that have been added or integrated but not synced) but the overall size of the files is smaller.
Lastly, if you want to know how many files will be synced along with the total size using 'p4 sync', try the following trick:
p4 -ztag sync -n -m1 //path | grep total
p4 -ztag sync -n -m1 jamgraph/... | grep total
... totalFileSize 338986
... totalFileCount 15
For more information on how you can reduce the size of some database tables by deleting workspace clients not accessed recently and are no longer needed, please take a look at the knowledge base article on Making Large Repositories Smaller.