Finds all paths of files with the given name in a parent folder. Args: parent_folder: The path to the parent folder. file_name: The name of the file to find. Returns: A list of all full paths to the files if found, otherwise an empty list.
(parent_folder, file_name)
| 528 | return None |
| 529 | |
| 530 | def find_all_file_paths(parent_folder, file_name): |
| 531 | """Finds all paths of files with the given name in a parent folder. |
| 532 | |
| 533 | Args: |
| 534 | parent_folder: The path to the parent folder. |
| 535 | file_name: The name of the file to find. |
| 536 | |
| 537 | Returns: |
| 538 | A list of all full paths to the files if found, otherwise an empty list. |
| 539 | """ |
| 540 | |
| 541 | file_paths = [] |
| 542 | for root, _, files in os.walk(parent_folder): |
| 543 | if file_name in files: |
| 544 | file_paths.append(os.path.join(root, file_name)) |
| 545 | |
| 546 | return file_paths |
| 547 | |
| 548 | from pathlib import Path |
| 549 |
no test coverage detected