Is there any was to delete only view private files in CC dynamic view. There are a bunch of eclipsed files and view private files in my view. I need to delete only view private files and retain checked-out and eclipsed files.
I tried following -
cleartool ls -r | grep -v eclipsed | grep -v checkedout | xargs rm -v
But looks like eclipsed files are listed twice with cleartool ls
. So it deletes eclipsed files too :(
cleartool ls -r produces two outputs for an eclipsed
file in dynamic view.
src.mk
src.mk@@ [eclipsed]
So deleting with cleartool ls -rec | grep -v "Rule:" | grep -v "eclipsed" | grep -v "-->" | xargs rm -v
deletes eclipsed files too.
You are right, none of those two soution would work:
cleartool ls -rec | grep -v "Rule:" | grep -v "eclipsed" | grep -v "-->" | xargs rm -v
cleartool lsprivate | grep -v "eclipsed" | xargs rm -v
Source: my old answer at "Command to find all view private files in the current directory recursively".
An lsprivate
alone lists eclipsed file like any other private file:
M:\yourDynView\yourVob\aDir\>ct lsprivate
M:\yourDynView\yourVob\aDir\aFile.vsd
M:\yourDynView\yourVob\aDir\aPrivateFile
But, an lsprivate -l
list eclipsed file twice:
M:\yourDynView\YourVob>ct lsprivate -long
view private object M:\yourDynView\yourVob\aDir\aFile.vsd
file element M:\yourDynView\yourVob\aDir\aFile.vsd@@ [eclipsed]
view private object M:\yourDynView\yourVob\aDir\aPrivateFile
So you need three passes
- one to generate that
cleartool lsprivate -l
- one to remove any line above a line which contains
eclipsed
- one to read that file and delete the remaining private files listed in that file
The second step could be (loosely tested after this thread)
gawk "{if ((NR!=1)&&($0!~/eclipsed/)) {if ($lastlin!~/eclipsed/) {print astlin};lastlin=$0} } END{print lastlin} " s
With 's
' the file containing the result of a cleartool lsprivate -l
.