Created
March 2, 2018 14:18
-
-
Save vadella/7ccd66ea12278acb398b7076b3462efa to your computer and use it in GitHub Desktop.
recursive or not via pathlib.Path
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 files_under(directory, recursive=True): | |
root = Path(directory) | |
pattern = '**/*' if recursive else '*' | |
yield from root.glob(pattern) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment