X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fsplit_done.py;h=5f8faddaf8e4041e05fffdc1b0ef7915ed91547b;hb=f8a0c616c5fb38451273419a53380c42522ab9d0;hp=3c50bd1b20d37288c642559b93d6f2f12dc91c06;hpb=e2ae71066cbb134753d7bfceb16e87d0b76dfd6e;p=dak.git diff --git a/dak/split_done.py b/dak/split_done.py index 3c50bd1b..5f8fadda 100755 --- a/dak/split_done.py +++ b/dak/split_done.py @@ -19,26 +19,30 @@ ################################################################################ import glob, os, stat, time -import daklib.utils +from daklib import utils ################################################################################ def main(): - Cnf = daklib.utils.get_conf() + Cnf = utils.get_conf() count = 0 + move_date = int(time.time())-(30*84600) os.chdir(Cnf["Dir::Queue::Done"]) files = glob.glob("%s/*" % (Cnf["Dir::Queue::Done"])) for filename in files: if os.path.isfile(filename): - mtime = time.gmtime(os.stat(filename)[stat.ST_MTIME]) + filemtime = os.stat(filename)[stat.ST_MTIME] + if filemtime > move_date: + continue + mtime = time.gmtime(filemtime) dirname = time.strftime("%Y/%m/%d", mtime) if not os.path.exists(dirname): print "Creating: %s" % (dirname) os.makedirs(dirname) dest = dirname + '/' + os.path.basename(filename) if os.path.exists(dest): - daklib.utils.fubar("%s already exists." % (dest)) - print "Move: %s -> %s" % (filename, dest) + utils.fubar("%s already exists." % (dest)) + print "Move: %s -> %s" % (filename, dest) os.rename(filename, dest) count = count + 1 print "Moved %d files." % (count)