This should get you started. There are lots of examples out there on how to write code to loop through the files in a folder.
Code:
Sub ScratchMacro()
'A basic Word Macro coded by Gregory K. Maxey
Dim strSrch() As String
Dim lngIndex As Long
Dim oRng As Range
Dim lngCount As Long
Dim oTbl As Table
Set oTbl = ActiveDocument.Tables(1)
strSrch = Split("% if|% elif|% else|% endif|%p if|%p elif|%p else|%p endif", "|")
oTbl.Rows(2).Cells(1).Range.Text = ActiveDocument.FullName
For lngIndex = 0 To UBound(strSrch)
lngCount = 0
Set oRng = ActiveDocument.Range
With oRng.Find
.Text = strSrch(lngIndex)
While .Execute
lngCount = lngCount + 1
oRng.Collapse wdCollapseEnd
Wend
oTbl.Rows(2).Cells(lngIndex + 2).Range.Text = lngCount
End With
Next
lbl_Exit:
Exit Sub
End Sub