Last active
December 31, 2015 07:29
-
-
Save lwzm/7954352 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
import os | |
import os.path | |
def walk(directory, dir_filter=None, file_filter=None): | |
"""return a list of all files in this directory, sorted""" | |
all_files = [] | |
for root, dirs, files in os.walk(directory): | |
dirs[:] = sorted(filter(dir_filter, dirs)) | |
all_files.extend(map(lambda f: os.path.abspath(os.path.join(root, f)), | |
sorted(filter(file_filter, files)))) | |
return all_files | |
for f in walk( | |
".", | |
lambda s: not s.startswith("."), | |
lambda s: s.endswith(".xls") and not s.startswith("."), | |
): | |
print(os.path.getmtime(f)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment