' vbExclamation = 32
' vbCancel = 2
' vbYesNoCancel = 3
' vbYes = 6
' vbNo = 7
' vbDefaultButton2 = 256
vbFlags = vbExclamation + vbYesNoCancel + vbDefaultButton2
VssPath = "D:\Microsoft Visual Studio\VSS\srcsafe.ini"
SrcProject = "$/"
Dim shell
Set shell = CreateObject("WScript.Shell")
' Start the SourceSafe process and open the connection to the database
' at VSSPath (specified above).
Dim oVSSDB
Set oVSSDB = CreateObject("SourceSafe")
oVSSDB.Open VssPath
' Purge starting with the SrcProject (specified above).
SSPurge SrcProject
'*****************
' Function SSPurge
'
' Destroys deleted items in a sourcesafe database. This function goes
' through each item one at a time and asks the user to confirm the
' call to delete it permanently. If the item is a project, then this
' function is called recursively on that project.
'*****************
Function SSPurge(SrcProject)
Dim oVSSProject, oVSSItem
Set oVSSProject = oVSSDB.VSSItem(SrcProject)
For Each oVSSItem In oVSSProject.Items(True)
CurObject = SrcProject + "/" + oVSSItem.Name
If oVSSItem.Deleted Then
retVal = shell.Popup("Do you want to destroy: " _
+ CurObject + "?", 0, "Destroy File?", vbFlags)
Select Case retVal
' Case vbNo - Do nothing
Case vbYes
oVSSItem.Destroy
Case vbCancel
WScript.Quit()
End Select
ElseIf oVSSItem.Type = VSSITEM_PROJECT Then
SSPurge CurObject
End If
Next
End Function