Created
March 26, 2018 11:44
-
-
Save Horaddrim/c9b7e287d6c21a9b04933fd0f570014b 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
| import os | |
| import fnmatch | |
| def gen_find(filepat,top): | |
| for path, dirlist, filelist in os.walk(top): | |
| for name in fnmatch.filter(filelist,filepat): | |
| yield os.path.join(path,name) | |
| # Example use | |
| if __name__ == '__main__': | |
| lognames = gen_find("access-log*","www") | |
| for name in lognames: | |
| print name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment