I have a python script that recursively searches folders to find matching file names. I was wondering if I could improve performance with threads or something like that.
import os
def search_folder(root, name, check_case = False):
for root, dirs, files in os.walk(root):
if check_case:
if name in files:
print(os.path.join(root, name))
else:
if name.lower() in map(lambda x: x.lower(), files):
print(os.path.join(root, name))
for directory in dirs:
search_folder(os.path.join(root, directory), name, check_case)
def main():
root_path, desired_file, check_case = "C:/", "hollow", "n"
search_folder(root_path, desired_file, check_case)
if __name__ == "__main__":
main()