Wednesday, September 07, 2022

Useful Perforce Commands

 Perfoce Commands are especially useful when you are working on multiple branches and you don't want to download all branches but want to get some information. 

Before you proceed make sure you understand how wild cards work in perforce command: https://www.perforce.com/manuals/cmdref/Content/CmdRef/filespecs.html 

Search Text in All Readme.txt at any subfolder level of //depot/xxx/yyy/abc/

p4 grep -i -e "mytext" //depot/xxx/yyy/abc/.../Readme.txt

or (to cover .md and .txt files)

p4 grep -s -e -i "punta" //depot/iView/GTM_Branches/Release/.../Readme.*


Search Directory by name

p4 dirs -i "//depot/xxx/yyy/abc/*/def/dir_to_search"

also,

p4 dirs -i "//depot/xxx/yyy/abc/*/def/*dir_to_search*"

for searching file, use "files" command instead of "dirs command.

Use @@1 instead of * for single level search

Get Last Check-in info for a directory

p4 changes -m 1 "//depot/xxx/yyy/abc/*/def/…"


Diff between two files

p4 diff "//depot/xxx/def.txt" "//depot/yyy/def.txt"

File Sizes by name

p4 sizes -h "//depot/.../def.txt"