Created
April 10, 2022 14:03
-
-
Save pointofpresence/92b18c19652ce66805d41de9b1ecf302 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 cool_glob(dir_list, patterns_list, recursive=False): | |
| output = [] | |
| template = '**/{pattern}' if recursive else '{pattern}' | |
| for dir_name in list(set(dir_list)): | |
| for pattern in list(set(patterns_list)): | |
| output.extend(list(pathlib.Path(dir_name).glob(template.format(pattern=pattern)))) | |
| return output | |
| res = cool_glob( | |
| [r'K:\_SYNTHWAVE\music\cover', r'K:\_CLIPARTS\Космос'], | |
| ['*.png', '*.jpg', '*.gif', '*.jpeg'], | |
| True | |
| ) | |
| print(res) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment