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

P4 CLI Documentation | 2025.2

# Delete files

To delete files from the depot, do NOT delete the files from your file system. Instead, first you mark or open the files for delete, and then you submit the changelist.

To mark files for delete, issue the `p4 delete` command. In this case, we choose to delete just the header files.

    p4 delete *.h

P4 Server displays the following:

    //JamCode/main/file1.h#1 - opened for delete
    //JamCode/main/file2.h#1 - opened for delete
    //JamCode/main/file3.h#1 - opened for delete

As in Edit files, you issue the `p4 submit` command to have the deletion affect files in the depot:

    p4 submit

P4 Server opens the `change specification` in an editor:

Copy

    # A Perforce Change Specification.
    #
    #  Change:      The change number. 'new' on a new changelist.
    #  Date:        The date this specification was last modified.
    #  Client:      The client on which the changelist was created.  Read-only.
    #  User:        The user who created the changelist.
    #  Status:      Either 'pending' or 'submitted'. Read-only.
    #  Type:        Either 'public' or 'restricted'. Default is 'public'.
    #  Description: Comments about the changelist.  Required.
    #  ImportedBy:  The user who fetched or pushed this change to this server.
    #  Identity:    Identifier for this change.
    #  Jobs:        What opened jobs are to be closed by this changelist.
    #               You may delete jobs from this list.  (New changelists only.)
    #  Files:       What opened files from the default changelist are to be added
    #               to this changelist.  You may delete files from this list.
    #               (New changelists only.)

    Change: new

    Client: maria_ws

    User:   maria

    Status: new

    Description:
        enter description here

    Files:
        //JamCode/main/file1.h # delete
        //JamCode/main/file2.h # delete
        //JamCode/main/file3.h # delete

Enter a description under `Description`, save your changes, and exit the editor. This stores the record in the depot of the files being deleted. The output might be:

    Change 3 created with 3 open file(s).
    Submitting change 3.
    Locking 3 files ...
    delete //JamCode/main/file1.h#2
    delete //JamCode/main/file2.h#2
    delete //JamCode/main/file3.h#2
    Change 3 submitted.

Your search for returned results