import os
from datetime import datetime

now = datetime.now()

for dpath,dnames,fnames in os.walk('./', topdown=False) :
    for fname in fnames:
        filepath =  os.path.join(dpath, fname)
        stat = os.stat(filepath)
        lastAccess = datetime.fromtimestamp(stat.st_mtime)
        
        age = now - lastAccess
        print(filepath + '--- last update ' + str(age.days) + ' days ago.')
    
    for dname in dnames :
        dirpath = os.path.join(dpath, dname)
        files = len(os.listdir(dirpath))
        
        print(dirpath + '--- has ' + str(files) + ' files.')
 
./.settings/org.eclipse.core.resources.prefs--- last update 4 days ago.
./__pycache__/myDateConv.cpython-32.pyc--- last update 4 days ago.
./__pycache__/myDateConvTest.cpython-32.pyc--- last update 4 days ago.
./.project--- last update 34 days ago.
./.pydevproject--- last update 34 days ago.
./mailexample.py--- last update 4 days ago.
./myDateConv.py--- last update 4 days ago.
./myDateConvTest.py--- last update 4 days ago.
./walk.py--- last update 0 days ago.
./.settings--- has 1 files.
./__pycache__--- has 2 files.

Python


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS   sitemap
Last-modified: 2012-10-28 (日) 22:08:41 (1496d)
ISBN10
ISBN13
9784061426061