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

P4 CLI Documentation | 2026.1

# p4 clean

Restore client workspace files to match the state of corresponding depot files.

The `p4 clean` command is equivalent to the `p4 reconcile -w` command.

## Syntax

    p4 [g-opts] clean [-e -a -d -I -l -K -m  -n] [file ...]

Syntax and naming conventions

## Description

The `p4 clean` command takes the following actions when finding inconsistencies between the files in a user’s client workspace and the corresponding depot files:

Before you issue the command to have p4 clean delete files, make sure that you have successfully navigated to the correct directory. Otherwise, you might unintentionally delete local files that you want to keep.

Files present in the workspace but missing from the depot are deleted from the workspace.

Files present in the depot but missing from your workspace are added to the workspace at the revision synced from the depot.

Files modified in your workspace that are not opened for add, edit, delete, or integrate are restored to the last revision synced from the depot.

Files in your workspace that are opened for add, edit, delete, or integrate are not impacted by `p4 clean`.

To limit the scope of `p4 clean` to add, edit, or delete, use the `-a`, `-e`, or `-d` options. For example, using the `-a` option finds files that have been added to the workspace but do not correspond to files in the depot, and deletes those files from your workspace.

By default, `p4 clean` does not check the files or paths listed in the `P4IGNORE` file if they have been added rather than edited. To cause `p4 clean` to check the files or paths listed in the `P4IGNORE` file whether or not those files have been added or edited, use the `-I` option.

To preview the set of proposed workspace reconciliation actions, use the `-n` option.

## Options

Option | Description
--- | ---
`-a` | Added files: Find files in the workspace that have no corresponding files in the depot and delete them.
`-d` | Deleted files: Find those files in the depot that do not exist in your workspace and add them to the workspace.
`-e` | Edited files: Find files in the workspace that have been modified and restore them to the last file version that has synced from the depot.
`-I` | Do not perform any ignore checking, which means to ignore any settings specified by `P4IGNORE` for added files.
`-m` | Compare the file sync or submit time (in the depot) with the file `modification time` (in the workspace) to help determine whether the file has changed. Normally P4 Server uses file digests to determine whether files in the workspace differ from the head revisions of these files in the depot. This can be time consuming for large files. But when the timestamps are the same, the costly digest comparisons can be skipped. This option is only relevant if you are using clean to find changed files rather than files that were deleted or added.
`-l` | Display output in local file syntax with relative paths, similar to the workspace-centric view of `p4 status`.
`-n` | Preview the results of the operation without performing any action.
file | The files whose versions you want reconciled with their latest depot versions. If you omit this parameter, the files in your local working directory are used.
`-K` | Suppress keyword expansion when updating `+k` type files on the client. See File type modifiers.
`g-opts` | See Global options.

## Usage notes

Can file arguments use revision specifier? | Can file arguments use revision range? | Minimal access level required
--- | --- | ---
No | No | `read`

- The `p4 clean` command produces output in depot syntax. To see file names and paths in local syntax, you must use the `-l` option, or use `p4 status`. Compare the output of the following commands, one without the `-l` option, and the other one with the option.

      C:\test\local\client\copy\l>p4 clean -n bar
      //depot/copy/l/bar#none - deleted as c:\test\local\client\copy\l\bar
      C:\test\local\client\copy\l>p4 clean -n -l bar
      //depot/copy/l/bar#none - deleted as bar

- When called without arguments, `p4 clean` adjusts the specified files in your workspace to reflect their latest state in the depot.

- See also Default ignored paths in the p4 ignores topic and the `.p4ignore` token under Notes and examples in P4IGNORE.

## Related commands

An equivalent for `p4 reconcile -w` | `p4 reconcile`

Your search for returned results