Last active
January 12, 2020 08:31
-
-
Save NicHub/9dc7bae12f79dc9fe07bbe8e8ed94508 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import pathlib2 | |
def recursive_file_search_with_pattern(root_path, pattern): | |
pl_dir = pathlib2.Path(root_path) | |
file_list = [path.resolve() | |
for path in sorted(pl_dir.rglob(pattern)) | |
if path.is_file()] | |
return file_list | |
if __name__ == "__main__": | |
root_path = "~/" | |
pattern = '*.nmea' | |
file_list = recursive_file_search_with_pattern(root_path, pattern) | |
for cnt, file_ in enumerate(file_list): | |
print(f"{(cnt + 1):3}. {file_}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment