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

P4 CLI Reference | 2025.1

# p4 files

Provide information about files in the depot without accessing their contents.

## Syntax

    p4 [g-opts] files [-a -A -e] [-i][-m max] FileSpec[revSpec]
    p4 [g-opts] files [-a] [-e] [-m max] [--streamviews] FileSpec[revSpec]
    p4 [g-opts] files -U unloadFileSpec

Syntax conventions

## Description

This command lists each file that matches the file patterns provided as arguments. If a revision specifier is given, the files are described at the given revision. One file is listed per line, and the format of each line is:

    depot-file-location#rev - action change changelist (filetype)

where:

- depot-file-location is the file’s location relative to the top of the depot,
- rev is the revision number of the head revision of that file,
- action is the action taken at the head revision: `add`, `edit`, `delete`, `branch`, `move/add`, `move/delete`, `integrate`, `import`, `purge`, or `archive`,
- changelist is the number of the changelist in which the revision was submitted, and
- filetype is the P4 Server file type of this file at the head revision.

Unlike most P4 Server commands, `p4 files` reports on any file in the depot. I t is not limited to only those files that are visible through the client view. If a file pattern on the command line is given in client syntax, only files in the client workspace are shown.

## Options

`-a` | For each file, list all revisions within a specified revision range, rather than only the highest revision in the range.
`-A` | Limit output to files in archive depots.
`-e` | Exclude deleted, purged, or archived files; the files that remain are those available for syncing or integration.
`-i` | Ignore the case of the file argument when listing files in a case sensitive server.
`-m max` | Limit output to the first `max` files.
`-U unloadfile` | List only files in the unload depot. See `p4 unload` for details.
`--streamviews` | Report files and directories from stream Paths and Components, where imported files are represented as symbolic links under the stream depot path. See the Viewing imported files example under Stream Components > in the P4 CLI Documentation.
`g-opts` | See Global options.

## Usage notes

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

- The specified revision can be a revision range. In this case, only those files with revisions within the specified range are listed, and by default, only the highest revision in that range is listed. (To display information for all files within a revision range, use `p4 files -a`.)
- The output of `p4 files` can be large when called with non-restrictive file arguments. For example, `p4 files //depot/...` prints information about all the files in the depot. However, `p4 files` commands can be subject to a `maxresults` limitation that is set in `p4 group`.

## Examples

`p4 files //depot/...` | Provides information about all files in the depot.
`p4 files //clientname/...` | Provides information about all depot files visible through the client view.
`p4 files -i //CLIENTName/...` | Case-insensitive version of p4 files //clientname/...
`p4 files @2011/03/10` | Provides information about all depot file revisions that existed on March 10, 2011.
`p4 files @2011/03/31:08:00,@2011/03/31:17:00` | Lists all files and revisions changed during business hours on March 31, 2011.
p4 files @=14 | Lists the files shelved or submitted in the specified changelist.
p4 files //depot/foo/...@12 | List the files in the path specified for all changelists up to specified changelist.
p4 files //depot/foo/...@12,@12 | List only the files in the path specified for the specified changelist. In other words, the list begins and ends at the same changelist number.
`p4 files //depot/proj2/...@p2lab` | Lists files and revisions under the directory `//depot/proj2/...` tagged by label `p2lab`.
`p4 files //depot/file.c` | Show information on the head revision of `//depot/file.c`. (that is, the highest revision in the implied range of `#1,#head`).
`p4 files -a //depot/file.c` | Show information on every revision of `//depot/file.c` (that is, all revisions in the implied range of `#1,#head`).
`p4 files -A //arch/depot/proj/...` | If an administrator has used `p4 archive` to transfer `//depot/proj/...` to an archive depot named `arch`, displays information about the files in the archived project.

## Related commands

To list the revision history of files | `p4 filelog`
To see a list of all currently opened files | `p4 opened`
To see a list of the file revisions you’ve synced to | `p4 have`
To view the contents of depot files | `p4 print`

Your search for returned results