X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=dak%2Fsplit_done.py;fp=dak%2Fsplit_done.py;h=0000000000000000000000000000000000000000;hb=bb709de9e377628445e0fd892c121c10ad34a5a9;hp=3d07287240f18fb4e5272274dffc53fa8fe7d760;hpb=ff855feb8d6b77c271b89bcd8915f43c043caefa;p=dak.git diff --git a/dak/split_done.py b/dak/split_done.py deleted file mode 100755 index 3d072872..00000000 --- a/dak/split_done.py +++ /dev/null @@ -1,56 +0,0 @@ -#!/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 -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -################################################################################ - -import glob, os, stat, time -from daklib import utils - -################################################################################ - -def main(): - Cnf = utils.get_conf() - count = 0 - move_date = int(time.time()) - os.chdir(Cnf["Dir::Done"]) - files = glob.glob("%s/*" % (Cnf["Dir::Done"])) - for filename in files: - if os.path.isfile(filename): - 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): - utils.warn("%s already exists." % (dest)) - continue - print "Move: %s -> %s" % (filename, dest) - os.rename(filename, dest) - count = count + 1 - print "Moved %d files." % (count) - -############################################################ - -if __name__ == '__main__': - main()