NotFound or Unloaded RevitLinked Delete

python
#1

NotFound or Unloaded RevitLinked - Delete : Python Script

.
.
.
count = 0

linkCollector = FilteredElementCollector(doc)
RvtLinks = linkCollector.OfClass(RevitLinkType).ToElements()

TransactionManager.Instance.EnsureInTransaction(doc)

for link in RvtLinks:
state = link.GetLinkedFileStatus()
if (state == LinkedFileStatus.NotFound) or (state == LinkedFileStatus.Unloaded):
doc.Delete(link.Id)
count = count + 1

TransactionManager.Instance.TransactionTaskDone()

OUT = str(count) + " Deleted"

#2

what does the script do?
delete the “not found” or “unloaded revit link”?

#3

full script : Full script