]> git.parisson.com Git - yomguy-tools.git/commitdiff
adapt to PB database
authoryomguy <yomguy@457c0346-1240-4656-8a5a-9edca8063506>
Tue, 28 Jul 2009 07:55:38 +0000 (07:55 +0000)
committeryomguy <yomguy@457c0346-1240-4656-8a5a-9edca8063506>
Tue, 28 Jul 2009 07:55:38 +0000 (07:55 +0000)
git-svn-id: http://svn.parisson.org/svn/tools/trunk@71 457c0346-1240-4656-8a5a-9edca8063506

various/date_filter.py

index a82e2faf395905bc6415e5c002a07716770fdeba..55580b247c7ca8223f0a63dcc8f0102c67d047af 100755 (executable)
@@ -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