import os, time, sys, shutil try: 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"