How do I retrieve the size of a directory from Perforce?
Asked Answered
M

4

20

I would like to know how much disk space a directory is going to consume before I bring it over from the Perforce server. I don't see any way to do this other than getting the files and looking at the size of the directory in a file manager. This, of course, defeats the purpose.

Is there a way to get file size info from Perforce without actually getting the files?

Molding answered 6/10, 2008 at 13:39 Comment(0)
M
30

I don't know how I missed this command, but here's how you do it:

p4 sizes -s //depot/directory/...

Molding answered 6/10, 2008 at 17:50 Comment(1)
Note that ... is crucial (I originally took it as "the rest of the path")Ope
L
2

p4 fstat

Larimor answered 6/10, 2008 at 13:42 Comment(2)
I can get the size of a file that way, but I guess I was really more interested in getting the size of a directory (I'll edit my question). Something like "p4 dstat".Molding
total = 0 foreach file in mydir do p4 fstat file total += size of file done :-)Larimor
M
0

Combined the solutions of everybody together to get it to work.

p4 sizes -s //depot/...

If you never used the console before - you can just open Windows' CMD and type that right in there.

Meli answered 23/12, 2023 at 1:39 Comment(0)
H
-1

The accepted answer didn't work for me, it just outputs 0 for a top level directory. Seems to work fine for any child directories.

But this worked for the root of the tree:

p4 sizes -h -s //depot/directory/*/...

Added -h to print size as human readable number with nice units

Homeomorphism answered 6/6, 2023 at 12:52 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.