19

The p4v Perforce GUI client has an 'Actions > Remove from Workspace' menu command which removes all files from the workspace that are under version control and were not opened for edit or delete.

This functionality only seems to be available from the GUI client, I can't find any corresponding command in the ever growing list shown by p4 help commands.

I thought of using p4 where, p4 files and some list filtering, but that doesn't seem trivial, so before I go about creating a script, does anyone have a better idea ?

1
  • 1
    I always thought that "Remove from Workspace" was badly named, since it could also imply removing the file/folder from your client spec. Feb 23, 2010 at 0:02

3 Answers 3

34

Specifying a revision of either #none or #0 will remove the files:

p4 sync //depot/project/...#none
p4 sync //depot/project/...#0

Use the -f switch to force removal of the files even if they are writeable (it won't affect files that are checked out, however):

p4 sync -f //depot/project/...#0
2
  • thank you very much guys, I'm so glad I asked here first! :-)
    – ssc
    Feb 23, 2010 at 23:16
  • i was looking all over for this
    – cmcginty
    Dec 14, 2012 at 3:40
10
p4 sync ...#none
4

The easy way to find GUI equivalent commands (p4 CLI commands) is to look at log tab in P4V. When we take any action on P4V GUI, the "log" tab shows the corresponding P4 CLI command being executed.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.