p4 copy

Copy files and/or the stream spec from one location in the depot to another.


p4 [g-opts] copy [-c change] [-n -f -K -v -q] [-m max] fromFile[rev] toFile
p4 [g-opts] copy [-c change] [-n -f -K -v -q] [-m max] -b branch [-r] [toFile[rev] ...]
p4 [g-opts] copy [-c change] [-n -f -K -v -q] [-m max] -b branch -s  fromFile[rev] [toFile ...]
p4 [g-opts] copy [-c change] [-n -f -K -v -q] [-m max] -S stream [-P parent] [-Fr] [toFile[rev] ...]
p4 [g-opts] copy [options] -S stream [-Af | -As] [-P parent] [-F] [-r] [toFile[rev] ...]

Syntax conventions


Using the client workspace as a staging area, the p4 copy command propagates an exact copy of the source files to the specified target by branching, replacing, or deleting files. No manual resolve is required. Changes in the target that were not previously merged into the source are overwritten. To update the target, submit the files. To revert copied files, use the p4 revert command.

Target files that are identical to the source are not affected by the p4 copy command unless you use the -f option. When p4 copy creates or modifies files in the workspace, it leaves them read-only. You can use p4 edit to make them writable.


This command also works with openable stream specifications. p4 copy -S stream is described in the Options section.

In most cases, p4 copy command performs a lazy copyClosed A method used by Helix Core Server to make internal copies of files without duplicating file content in the depot. A lazy copy points to the original versioned file (depot file). Lazy copies minimize the consumption of disk space by storing references to the original file instead of making additional copies of the file.. The contents of the file are not duplicated on the server because the integration record contains sufficient information to reproduce the file.


-b branch

Specify a branch view to be used to determine source and target files.

-c change

Open the files in the specified pending changelist rather than in the default changelist.


Force the creation of extra revisions in order to explicitly record that files have been copied. Deleted source files are copied if they do not exist in the target, and files that are already identical are copied if they are not connected by existing integration records.


Force copy operation; perform the operation when the target stream is not configured to accept a copy of the source. To determine a stream’s expected flow of change, use p4 istat.

-m max

Specify the maximum number of files to copy, to limit the size of the operation.

-K Suppress keyword expansion when updating +k type files on the client. See File type modifiers.


Preview the copy.

-P parent

Specify a target stream other than the parent of the source stream. Requires -S.


Quiet mode, which suppresses normal output messages about the list of files being integrated, copied, or merged. Messages regarding errors or exceptional conditions are displayed.

-r [toFile[rev] ...]

Reverse the mappings in the branch view, integrating from the target files to the source files. Requires the -b option.

-s fromFile[rev] [toFile ...]

Treat fromFile as the source and both sides of the branch view as the target. To restrict the scope of the target further, specify the optional toFile parameter. Overrides the -r option, if specified. Requires -b.

-S stream

Causes p4 copy to use a generated branch view that maps the stream to its parent and copy from a stream to its parent. To reverse the copy direction, use -r with -S.

Copies the source stream spec propagatable fields into the target stream spec and opens for edit both the target stream spec and the stream files. However, you can specify:

-Af -As
Copy the files only Copy the stream spec only

Note that to submit copied stream files, the current client must be switched to the target stream or to a virtual child stream of the target stream.


Do not sync the target files. By default, p4 copy syncs the target files.

If a large number of files is involved and you do not require the files to be present in your workspace, you can minimize overhead and network traffic by specifying -v.


See Global options.

Usage Notes

Can File Arguments Use Revision Specifier? Can File Arguments Use Revision Range? Minimal Access Level Required

fromFile: Yes
toFile: No


read access for fromFile
open access for toFile

You can use a revision specifier to select the revision to copy; by default, the head revision is copied. The revision specifier can be used on fromFile or toFile, but not on both. When used on toFile, it refers to source revisions, not to target revisions. You may not use a range as a revision specifier.


p4 copy -S //projectX/dev

Create a stream quickly (without checking integration history)

p4 copy //projectX/dev/... //projectX/main/... Promote work from a development stream to the mainline

Related Commands

Update a child stream with a more stable parent stream

p4 merge

Propagate changes after considering all integration history
and scheduling resolves, if necessary

p4 integrate