From 4fd00034ac745f9963435a145de051a11e04021e Mon Sep 17 00:00:00 2001 From: yomguy Date: Tue, 28 Jul 2009 07:55:38 +0000 Subject: [PATCH] adapt to PB database git-svn-id: http://svn.parisson.org/svn/tools/trunk@71 457c0346-1240-4656-8a5a-9edca8063506 --- various/date_filter.py | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/various/date_filter.py b/various/date_filter.py index a82e2fa..55580b2 100755 --- a/various/date_filter.py +++ b/various/date_filter.py @@ -3,24 +3,40 @@ import os, time, sys -root = sys.argv[1] # one specific folder +root_orig = sys.argv[1] +#root_dest = sys.argv[2] +date_filter = '08' date_file_list = [] -for root, dirs, files in os.walk(root): +for root, dirs, files in os.walk(root_orig): for file in files: #print file stats = os.stat(root+os.sep+file) lastmod_date = time.localtime(stats[8]) - date_file_tuple = lastmod_date, root+os.sep+file + date_file_tuple = lastmod_date, root+os.sep+file, stats[6] date_file_list.append(date_file_tuple) date_file_list.sort() date_file_list.reverse() # newest mod date now first -print "%-40s %s" % ("filename:", "last modified:") +total_size = 0 +print "%-50s %s" % ("filename:", "last modified:") for file in date_file_list: if os.path.isfile(file[1]): - #folder, file_name = os.path.split(file[1]) file_date = time.strftime("%y/%m/%d %H:%M:%S", file[0]) - #print "%-40s %s" % (file_name, file_date) - print "%-50s %s" % (file[1], file_date) + year = time.strftime("%y", file[0]) + #dest_file = root_dest+os.sep+file[1] + if year <= date_filter and file[1].split('.')[-1] == 'mp3' and 'CRFPA' in file[1] : + #os.path.exists(dest_file) : + print "%-50s %s" % (file[1], file_date) + total_size += file[2] + + #os.system('sudo rm "' + file[1] + '"') + #os.system('sudo touch "' + file[1] + '"') + #os.system('sudo chown zope:zope "' + file[1] + '"') + #os.system('sudo chmod 600 "' + file[1] + '"') + + #os.symlink(dest_file, file[1]) + #print "File linked !" + +print total_size \ No newline at end of file -- 2.39.5