A function to check all files in a folder against a given pattern. Uses RegEx for the file pattern. Returns “true” or “false” for each file. Usage: FileMatch(“/path/to/folder”, “[a-z0-9]\.exe”, [bool], [bool]) Attributes: Folder path, pattern, recurse, display result # Import the basics import io import os import re # r=True will recursively search sub folders as well # v=True will print the results of the search def FileMatch(aFolder, aPattern, r=False, v=False): validArgs = True if not os.path.isdir(aFolder): if v: print(aFolder, “is not a valid directory”) validArgs = False try: cPattern = re.compile(aPattern) except Exception as e: if v: print(e) validArgs […]