Obliterate files with more than X revisions or delete all revisions but head revision
Posted 11 March 2020 - 04:57 PM
How would you obliterate all versions of all files in a directory and it's sub-directories with more than 10 revisions for example so that it keeps only the 10 latest revisions.
Or alternatively how can you obliterate all versions that are not the head revision in a directory and all of it's sub directories?
We're trying to clean up HDD space and we have quite a few old projects we only want to keep the most recent data from.
We applied a new typemap but this isn't relevant to all files currently on the depot.
Posted 17 March 2020 - 08:27 PM
Never, ever interrupt an obliterate. It can leave the metadata in a corrupt state, and you'll have to rebuild from the last checkpoint. Trust me on this.
Test the snot out of your scripts on a test server. A mistake here can be costly.
I've obliterated many hundreds of thousands of revs of files this way. Seriously. It's probably close to a million. I developed this method through sweat and tears, but thankfully no blood. 8^)
 I determine the number empirically, by testing, Pick the length of time you are OK with the server locking up, and use the max number of path/revs that comes in under that.
Posted 17 March 2020 - 10:51 PM
That's not to say there are certainly some legit reasons to obliterate data this way. I'm sure we all have some stories from the trenches:
* Automation that checks in identical iso's hundreds of times over the course of a couple years.
* Someone checking in massive amounts of personally identifiable medical data to a 'public' area (severe HIPPA violation.)
* Someone(s) checking git repos (.git directory) directly into Perforce (WTH? Seriously, people.)
If you think about this for about a week and still want to obliterate, please heed what Miles says up there. A misguided or mis-applied obliterate, and the following recovery efforts, will be one of the worst things you have to deal with in your career (speaking from experience.)
Currently unemployed, looking for work in Boise, ID!
Posted 17 March 2020 - 11:34 PM
I will also note that I developed the current scripts out of self-defense. We had met the enemy and he was us.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users