views:

1263

answers:

4

I am creating some build scripts that interact with Perforce and I would like to mark for delete a few files. What exactly is the P4 syntax using the command line?

+5  A: 
p4 delete filename

(output of p4 help delete)

delete -- Open an existing file to delete it from the depot

p4 delete [ -c changelist# ] [ -n ] file ...

Opens a file that currently exists in the depot for deletion.
If the file is present on the client it is removed.  If a pending
changelist number is given with the -c flag the opened file is
associated with that changelist, otherwise it is associated with
the 'default' pending changelist.

Files that are deleted generally do not appear on the have list.

The -n flag displays what would be opened for delete without actually
changing any files or metadata.
JR Lawhorne
+2  A: 

http://www.perforce.com/perforce/doc.062/manuals/boilerplates/quickstart.html

Deleting files

To delete files from both the Perforce server and your workspace, issue the p4 delete command. For example:

p4 delete demo.txt readme.txt

The specified files are removed from your workspace and marked for deletion from the server. If you decide you don't want to delete the files after all, issue the p4 revert command. When you revert files opened for delete, Perforce restores them to your workspace.

Swati
+5  A: 

Teach a man to fish:

  • p4 help - gets you general command syntax
  • p4 help commands - lists the commands
  • p4 help <command name> - provides detailed help for a specific command
Michael Burr
It does make you wonder how someone could think it is easier to ask here at SO than to look in the docs or Perforce website....
Greg Whitfield
Ray Vega
A: 

Admitted - it takes a (small) number of steps to find the (excellent!) Perforce user guide online in the version that matches your installation and get to the chapter with the information you need.

Whenever I find myself in need of anything about the p4 command line client, I rely on the help Perforce have built into it. Accessing it could not be easier:

  1. on the command line, enter p4

This gets you to the information Michael Burr has shown in his answer (and some more). If you do not get a help screen right away, something is wrong with our client configuration, e.g. P4PORT is not set properly. You obviously need to fix that first.

ssc