nanopyx.core.utils.find_files

 1import os
 2
 3
 4def find_files(root_dir, extension):
 5    """
 6    Returns a list of files with given extension in the root directory.
 7    """
 8    target_files = []
 9    for root, dirs, files in os.walk(root_dir):
10        for file in files:
11            if file.endswith(extension):
12                path = os.path.join(root, file)
13                target_files.append(path)
14                # print(f"Found file: {path}")
15
16    return target_files
def find_files(root_dir, extension):
 5def find_files(root_dir, extension):
 6    """
 7    Returns a list of files with given extension in the root directory.
 8    """
 9    target_files = []
10    for root, dirs, files in os.walk(root_dir):
11        for file in files:
12            if file.endswith(extension):
13                path = os.path.join(root, file)
14                target_files.append(path)
15                # print(f"Found file: {path}")
16
17    return target_files

Returns a list of files with given extension in the root directory.