Skip to content

Instantly share code, notes, and snippets.

@matthiasvegh
Created October 15, 2015 11:20
Show Gist options
  • Save matthiasvegh/30d8cd80451ee3885851 to your computer and use it in GitHub Desktop.
Save matthiasvegh/30d8cd80451ee3885851 to your computer and use it in GitHub Desktop.
Recursive Dates
#!/usr/bin/env python
import os
import time
def main():
rootDir = '/home/phil/workspace/clang-dump-names'
for dirName, subDirList, fileList in os.walk(rootDir):
depth = dirName.count(os.sep) - rootDir.count(os.sep)
indentation = '\t' * depth
print(indentation + dirName)
for fileName in fileList:
access = time.ctime(os.path.getatime(os.path.join(rootDir, dirName, fileName)))
creation = time.ctime(os.path.getctime(os.path.join(rootDir, dirName, fileName)))
modified = time.ctime(os.path.getmtime(os.path.join(rootDir, dirName, fileName)))
print(indentation + '\t' + fileName + ', accessed: ' + access + ', created: ' + creation + ', modified: ' + modified)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment