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

P4 CLI Documentation | 2025.2

# p4 cachepurge

Reclaim disk space on a replicated server.

## Syntax

    p4 [g-opts] cachepurge -a [-i N -n -R -S N -O] [-D file[revRange]]
    p4 [g-opts] cachepurge -f n [-i N -n -R -S N -O] [-D file[revRange]]
    p4 [g-opts] cachepurge -m n [-i N -n -R -S N -O] [-D file[revRange]]
    p4 [g-opts] cachepurge -s n [-i N -n -R -S N -O] [-D file[revRange]]

Syntax and naming conventions

## Description

A replica used as a standby spare or for disaster recovery maintains a complete copy of the target server The immediately upstream server for replica servers, edge servers, standby servers, proxies and brokers. See also 'upstream server' and 'central server'.’s versioned file archives. Replicas that are used for other purposes might not need to hold a copy of the content of every version of every file. If a replica is not needed for disaster recovery, you can reclaim disk space on it by periodically deleting versioned files. This is only safe to do if you have a backup of these files.

The `p4 cachepurge` command allows an administrator to reclaim disk space for those replicated servers that are not used for disaster recovery. File content is deleted only from the replica, not from the target server or from any other replica. If a command that accesses purged file content is issued to this replica, the file is retrieved from the target server.

Each time the `p4 cachepurge` command runs, it attempts to delete enough file content from the replica to achieve the goal set by the values specified for the command parameters.

## Options

Option | Description
--- | ---
`-a` | Delete all file content. This option reclaims the maximum amount of disk space, but any file content must be retrieved from the target server. If the `-O` option is not specified, file names are used to determine order of deletion.
`-D `file [revRange]`` | Limit action of command to the specified set of files (and revision range, if specified). To learn more, see Revision ranges.
`-f n` | Delete sufficient file content to leave `n` number of bytes of free space for the file system.
`-i n` | Repeat the command every `n` seconds. If you omit this option, the command runs only once.
`-m n` | Delete `n` file revisions. The amount of space this frees up depends on the size of the files.
`-n` | Display a preview of the `cachepurge` operation without deleting any files.
`-O` | Delete the files from the oldest to the newest; that is, delete older files before deleting newer files.
`-R` | Delete files in the order specified by the `-O` option. If the `-O` option is not specified, file names are used to determine order of deletion.
`-s n` | Delete `n` bytes of file data. This can be helpful in those cases when you can predict the growth rate of file system resources.
`-S n` | Do not delete the `n` most recent revisions of each file. For example, specifying `-S 1`, means that the head revision of each file is retained in the replica’s cache if it is already there.
`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 | `super`

Your search for returned results