Last active
March 20, 2024 10:01
-
-
Save ArthurDelannoyazerty/4ee434e0f7029fc1382ca2a1dbfa345b to your computer and use it in GitHub Desktop.
Find files with the corresponding extension in the selected folder and its subdirectories. Return the list of files paths
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_files_recursive_folder(folder_path:str, file_extension:str) -> list: | |
list_filepath = list() | |
for dirpath, _, filenames in os.walk(folder_path): | |
for filename in [f for f in filenames if f.endswith(file_extension)]: | |
filepath = dirpath.replace("\\","/") + "/" + filename | |
list_filepath.append(filepath) | |
return list_filepath |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment