(filepath: Union[str, pathlib.Path], pattern: str, reverse: bool = False)
| 147 | |
| 148 | @staticmethod |
| 149 | def first_file(filepath: Union[str, pathlib.Path], pattern: str, reverse: bool = False) -> Union[str, bool]: |
| 150 | if isinstance(filepath, str): |
| 151 | filepath = pathlib.Path(filepath) |
| 152 | results = [*filepath.glob(pattern)] |
| 153 | if not results: |
| 154 | return False |
| 155 | elif len(results) >= 1 and reverse: |
| 156 | results.sort(reverse=True) |
| 157 | return str(results[0].absolute()) |
| 158 | |
| 159 | @staticmethod |
| 160 | def folders_in_folder(filepath: str) -> List[str]: |