X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fsplit_done.py;h=8b5b57fe2ef2db0cf2b1a882ad7aa30615eb3422;hb=651efe1dd248dac0facf7c9e517efcd419cc0483;hp=2fd6f222133bd98d0a429d1b202832d9f7df39f1;hpb=cae814a1ffbbb2944931693f35f73062a5ea99e7;p=dak.git diff --git a/dak/split_done.py b/dak/split_done.py index 2fd6f222..8b5b57fe 100755 --- a/dak/split_done.py +++ b/dak/split_done.py @@ -1,6 +1,8 @@ #!/usr/bin/env python +""" Split queue/done into date based subdirectories """ # Copyright (C) 2004, 2005, 2006 James Troup +# Copyright (C) 2008 Joerg Jaspert # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -19,12 +21,12 @@ ################################################################################ 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"]) @@ -32,7 +34,7 @@ def main(): for filename in files: if os.path.isfile(filename): filemtime = os.stat(filename)[stat.ST_MTIME] - if filemtime < move_date: + if filemtime > move_date: continue mtime = time.gmtime(filemtime) dirname = time.strftime("%Y/%m/%d", mtime) @@ -41,8 +43,8 @@ def main(): 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)