Perforce P4 command line: How to find files in the repository?

10,473

In the shell:

p4 files '//.../*.c'

I've not used the C# P4 API, but I've used a few others, and they all have something like:

p4.run( 'files', '//.../*.c' )

A useful variant of 'p4 files' is 'p4 fstat', which has all kinds of filtering flags and yields a rich bouquet of state attributes.

Share:
10,473
Kevin
Author by

Kevin

Updated on August 22, 2022

Comments

  • Kevin
    Kevin over 1 year

    In P4V, I can enter the directory in the "Search in:" field, enter a file pattern such as "*.c" in the "Name contains:" field and hit "Find".

    How do I do that in a P4 (Windows DOS shell) command line or using the P4 APIs? I want to write a C# program to do this.

  • Mark
    Mark over 12 years
    You could be slightly more succinct with the command line would be 'p4 files //....c. The first three dots will match file or directory, and the last .c will match the extension.
  • Mehrdad Mirreza
    Mehrdad Mirreza about 9 years
    Didn't work for me: p4 files '//.../myfile.txt' Path 'c:\'//.../myfile.txt'' is not under client's root C:\Users\user\Perforce\myWS'. `