All pastes #183990 Raw Edit

nocture

public python v1 · immutable
#183990 ·published 2006-09-27 13:12 UTC
rendered paste body
import os, time, sys, shutiltry:    old = int(sys.argv[1])    large = int(sys.argv[2])except:    "Usage:", sys.argv[0]; sys.out(1)tmpdir = "tmp/"tmptree = "tmptree/"if os.path.isdir(tmptree):    os.chdir(tmptree)    print "forste if test"else:    print "doesn't exist"if os.path.isdir(tmpdir):    print "exists already"else:    print "mkdir"    os.mkdir(tmpdir)for i in os.listdir("."):    statinfo = os.stat(i)    if os.path.isdir(i):        for n in os.listdir(i):            if statinfo.st_size > large:                if statinfo.st_atime > old:                    shutil.copy(i, "tmp/")                    #os.remove(i)                    print "remove"     else:        print "navn:", i        print "size", statinfo.st_size        print "time", statinfo.st_atime        print "old", old        print "large", large        if statinfo.st_size > large:            if statinfo.st_atime > old:                shutil.copy(i, "tmp/")                print "remove"