INNER CODE UNIT · Python

search_files

crocs-muni/JCAlgTest · AlgTest_Process/prepare_known_cards.py:8

def search_files(folder):
    for root, dirs, files in os.walk(folder):
        yield from [os.path.join(root, x) for x in files]


def get_files_to_process(walk_dir: Path, required_extension: str):
    files_to_process = []
    for file_name in search_files(walk_dir):
        if not os.path.isfile(file_name):
            continue
        file_ext = file_name[file_name.rfind('.'):]
        if file_ext.lower() != required_extension:
            continue
        files_to_process.append(file_name)

    return files_to_process

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…