The p4 delete command marks the latest revision as deleted, but leaves the file information intact in the depot. As such, recovery from the server data is always possible.In contrast, p4 obliterate deletes the file data itself, precluding any possibility of recovery.Use p4 obliterate with caution. This is the only command in Perforce that actually removes file data.p4 obliterate can be used by Perforce administrators to permanently remove files from the depot. All information about the files is wiped out, including the files' revisions, the files' metadata, and any records in any labels or client workspace records that refer directly to those files. Once p4 obliterate completes, it appears to the server as if the affected file(s) had never existed. Copies of files in client workspaces are left untouched, but are no longer recognized as being under Perforce control.p4 obliterate requires at least one file pattern as an argument. To actually perform the obliteration, the -y flag is required; without it, p4 obliterate merely reports what it would do without actually performing the obliteration.If you specify a single revision (for instance, p4 obliterate file#3), only that revision of the file is obliterated. If you specify a revision range (for instance, p4 obliterate file#3,5), only the revisions in that range are obliterated.
-y filespec Perform the obliterate operation. Without this flag, p4 obliterate merely reports what it would do. See the Global Options section.
Can File Arguments Use
Revision Specifier? Can File Arguments Use
Revision Range? Minimal Access Level Required
• p4 obliterate is the correct way to reclaim disk space from files that are no longer required, or to clean up mistakes made by users who create file hierarchies in the wrong place. Do not use operating system commands (erase, rm, and their equivalents) to remove files from the Perforce server root by hand.
• Obliterating files can alter the behavior of user commands. Syncing to an obliterated revision will remove the file from your client workspace, syncing to the head revision will either remove the file from your client workspace (if all revisions were obliterated), or provide you with the most recent non-obliterated revision of the file.
• Obliterating files in revision ranges can also change the behavior of scripts, as revision numbers of files may "skip" obliterated revisions. For instance, the output of p4 filelog after obliterating revisions #2 and #3 might look like this:... #4 change 1276 edit on 2001/04/18 by user@dev1 (binary) 'Fixed'
... #1 change 1231 add on 2001/04/12 by user@dev1 (binary) 'First try'In this case, a developer using the #4 in the first line of the output to assume the existence of four change descriptions in the output of p4 filelog would be in trouble.
p4 obliterate dir/... Do not obliterate any files; list the files that would be obliterated with the -y option. p4 obliterate -y file p4 obliterate -y file#3 If #3 was the head revision, the new head revision is now #2 and the next revision will be revision #3. p4 obliterate -y file#3,5
To mark a file deleted at its head revision but leave it in the depot. This is the normal way of deleting files.