Jump to content


Retrieve number of files sync'd to a client


  • Please log in to reply
2 replies to this topic

#1 Miles O'Neal

Miles O'Neal

    Advanced Member

  • Members
  • PipPipPip
  • 204 posts
  • LocationAustin. Texas. Y'all.

Posted 24 July 2020 - 05:25 PM

Is there a more efficient way to get the number of files currently sync'd to a client or opened on a client? Right now I'm doing

p4 -c <client> have //<client>/... | wc -l
p4 opened -C <client> | wc -l

I can't find a command to just return a count rather than the list of files.

Thanks!

#2 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 1149 posts

Posted 24 July 2020 - 05:29 PM

For the "p4 have" case you could do:

C:\Perforce\test\python>p4 sizes -s @Samwise-dvcs-1509687817
@Samwise-dvcs-1509687817 42 files 19331 bytes

I don't think there's a way to do the same thing for the "opened" case since there's no revision specifier that'll only match opened files (unless you do something like pipe the opened file list into a label, which would defeat the purpose).

#3 Miles O'Neal

Miles O'Neal

    Advanced Member

  • Members
  • PipPipPip
  • 204 posts
  • LocationAustin. Texas. Y'all.

Posted 24 July 2020 - 07:31 PM

Perfect!

p4 -c <client> sizes -s #have

Of the two scenarios, this is the one with the most wasteful i/o, anyway. We have some rather large projects. It takes just as long, but that wasn't a surprise.

Thanks, Sam. You rock, as always.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users