[root@localhost conf]# cat find.py
import os
import time
def listdir(path):
for file in os.listdir(path):
if os.path.isfile(path+"/"+file):
ft = os.stat(path+"/"+file)
ltime = int(ft.st_mtime)
ntime = int(time.time())-3600*24*7
if ltime<=ntime:
print "delete"+" "+path+"/"+file;
os.remove(path+"/"+file)
elif os.path.isdir(path+"/"+file):
listdir(path+"/"+file)
listdir('/home')