Commit ee38b888 authored by Kirill Smelkov's avatar Kirill Smelkov

lsRt: Выводит содержимое ./ в обратном порядке по mtime

parent 6711b7ce
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Выводит содержимое ./ в обратном порядке по mtime"""
import os
from time import strftime, localtime
def main():
lsR = [] # [] of (path, stat)
for dirpath, dirnames, filenames in os.walk('.'):
for f in ['%s/' % _ for _ in dirnames] + filenames:
_ = '%s/%s' % (dirpath, f)
st = os.lstat(_)
lsR.append( (_, st) )
lsR.sort(key=lambda _: _[1].st_mtime)
for _, st in lsR:
print strftime('%Y-%m-%d %H:%M', localtime(st.st_mtime)), _
if __name__ == '__main__':
main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment