Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

P4 CLI Reference | 2025.1

# p4 sizes

Display size information for files in the depot.

## Syntax

    p4 [g-opts] sizes [-a -S] [-s|-z] [-b blocksize] [-h | -H] [-m max] FileSpec[revSpec]
    p4 [g-opts] sizes -C [-K] [-Q charset] [-B utf8bom] [-L line-ending] [-a -S] [-h|-H] [-m max] file[revRange] ...
    p4 [g-opts] sizes -A [-a -s] [-b blocksize] [-h|-H] [-m max] archiveFileSpec
    p4 [g-opts] sizes -U unloadFileSpec

Syntax conventions

## Description

The `p4 sizes` command displays the sizes of files stored in the depot. When called with no options, only the size of the head revision of the file or files is displayed. One line of output is provided per file.

Use the `-a` option to see how much space is occupied by each individual revision in the specified revision range, rather than just the highest revision in the specified range. One line of output is provided per file, per revision.

Use the `-s` option to obtain the sum of all files specified. Only one line of output is provided, showing the file specification, the number of files summarized, the total number of bytes required, and (if the `-b` option is provided) the total number of blocks required.

The `-h` or `-H` option displays size in human-readable form, using a scaling factor of 1,024 for `-h` or 1,000 for `-H`. The size displayed will be automatically scaled to bytes, kilobytes, megabytes, gigabytes, or terabytes, as needed. For example, if you specify `-h`, the output of 75,883,921 bytes, would be represented as 72.36 M.

The `-z` option works the same way as `-s`, but excludes space occupied by lazy copies (files that exist by virtue of integration operations). Use `-z` to estimate the space occupied by files on a P4 Server installation, and use `-s` to estimate the local disk space requirement if files were synced to a client workspace.)

## Options

`-a` | Include all revisions within the range, rather than just the highest revision in the range.
`-A` | Display files in archive depots. See `p4 archive` for details.
`-b blocksize` | Display results in blocks of `blocksize` bytes. Each accumulated file size is rounded up to the nearest `blocksize` bytes.
`-m max` | Limit output to `max` lines of output.
`-h` or `-H` | Display size in human-readable form, using a scaling factor of 1,024 for `-h` or 1,000 for `-H`. The size displayed will be automatically scaled to bytes, kilobytes, megabytes, gigabytes, or terabytes, as needed.
`-s` | Calculate the sum of the file sizes for the specified file argument.
`-S` | Display size information for shelved files only. If you use this option, revision specifications are not permitted.
`-U unloadfile` | List only file sizes in the unload depot. See `p4 unload` for details.
`-z` | When calculating size information, exclude lazy copies.
`-C` | Reports the file size expected in the workspace, using the client's environment by default to account for line-endings, charsets `unicode`/`utf8`/`utf16` filetypes (including the BoM for utf8 type files), and keyword expansion for `+k` type files. These variables can be explicitly overridden:
`-B utf8bom` | Override `filesys.utf8bom` for utf8 type files
`-K` | Collapse keywords for `+k` type files
`-L line-ending` | Override the client's line ending setting
`-Q charset` | Override P4CHARSET for unicode type files
`g-opts` | See Global options.

## Usage notes

Can File Arguments Use Revision Specifier? | Can File Arguments Use Revision Range? | Minimal Access Level Required
--- | --- | ---
N/A | N/A | `list`

- The `p4 sizes` command is functionally similar to the UNIX `du` command.
- If no revision range is specified, the implicit revision range of `#1` through `#head` is assumed.
- File sizes are based on the normalized (UNIX linefeed convention) and uncompressed version of the depot file, regardless of how the file is represented when synced to a client workspace.

## Examples

`p4 sizes file.c` | Show the size of the head revision of `file.c` in the depot.
`p4 sizes -a file.c` | Show the sizes of each revision of `file.c` stored in the depot.
`p4 sizes -s -a file.c` | Show the total size of all revisions of `file.c` stored in the depot.
`p4 sizes -s -a -b 512 //depot/...` | Show the number of files and the total disk space (in bytes and 512-byte blocks) currently used by a P4 Server installation hosting //depot/...
`p4 sizes -s //workspace/...` | Show the number of files and the total local disk space (in bytes) required to sync the head revisions of files mapped to the client workspace named `workspace`.

Your search for returned results