user00011
user00011

Reputation: 123

deleting a an entire directory tree from p4 workspace

The following is my folder structure

A
 a1
   a11
   a12
   a13
a2

i want to delete the entire tree of a1, including the files and subfolders in it. how to do that using p4 delete. Is it possible to delete folders/ should i empty each and every file from the subfolders.

I have 3000 files in a1. New to perforce hence not sure of the command.

Upvotes: 2

Views: 10711

Answers (2)

Samwise
Samwise

Reputation: 71454

Note that "delete from the workspace" and "delete from the depot" are two different things!

Perforce lets you arbitrarily sync individual files and directories to different revisions, so you have a lot of flexibility over what's in your workspace at any given time -- you can have some files synced to the latest revision and others synced to earlier revisions, and Perforce will track the state of each file individually so that everything can be reconciled later if needed. To completely remove files from the workspace, just sync them to #none:

p4 sync A/a1/...#none

You can easily get these files back later with another sync operation. What you're synced to in your own workspace does not affect anyone else.


To open the files for delete (which lets you delete them for EVERYONE, not just you), use p4 delete:

p4 delete A/a1/...

Now the files are "open for delete". To complete the action of deleting them from the depot, do:

p4 submit

and now the files are deleted at the head revision -- the next time anyone else syncs these files, they'll be removed from that workspace.

Upvotes: 3

Bartek Kobyłecki
Bartek Kobyłecki

Reputation: 2395

Yes, you need to specify the path to a1 in you depot and follow with ... at the end. Example:

p4 delete //depot/main/A/a1/...

Upvotes: 1

Related Questions