Cutsheet Puller Python

Hi,
I’m trying to use python to find a list of pdfs to copy to a folder via a dynamo graph. I am searching for a string somewhere in the name of the files within subdirectories to find cutsheets. What I have right now gets only half of the items in the list but appears to cycle the same index count as the list length. Here’s what I have so far:

import clr
import sys
sys.path.append(“C:\Program Files (x86)\IronPython 2.7\Lib”)
import os
import shutil
Copylist = IN[0]
DynamoPath = IN[1]
PATH = “H:\SamplePath\Cut Sheets”
exclude = [‘Archive’,“Lighting”]
matches =
a=0
b=
for root, subdir, files in os.walk(PATH):
[subdir.remove(d) for d in list(subdir) if d in exclude]
for file in files:
matches.append(os.path.join(root, file))
a=a+1
def Filter(string, substr):
[str for str in string if any(sub in str for sub in substr)]
return [str for str in string if any(sub in str for sub in substr)]
match1 = Filter(matches, Copylist)