import os import sys def find_file(root_dir, type): dirs_pool = [root_dir] dest_pool = [] def scan_dir(directory): entries = os.walk(directory) for root, dirs, files in entries: dirs_pool.extend([os.path.join(root, dir_entry) for dir_entry in dirs])…