Skip to content

Scripts related to devnotes

Louis Maddox edited this page Jan 8, 2018 · 4 revisions

After downloading the devnotes wiki as a git repo, it's helpful to use some scripting to work with the files

with os.scandir(path) as it:
    wl = [x for entry in it if not entry.name.startswith('.') and entry.is_file()]

wl.sort(key=lambda x: stat(x).st_mtime)
wl.reverse()
i = len([x for x in wl if stat(x).st_mtime == stat(wl[0]).st_mtime])
print('\n'.join([x.name+"\t"+x.stat() for x in wl[0:i]]))
  • N.B. to get to normal datetime format:
    from datetime import datetime as dt
    str(dt.fromtimestamp(teststat.st_mtime)).split(' ')[0]
Clone this wiki locally