]> git.parisson.com Git - tools.git/commitdiff
date_filter
authoryomguy <yomguy@457c0346-1240-4656-8a5a-9edca8063506>
Fri, 24 Jul 2009 09:51:56 +0000 (09:51 +0000)
committeryomguy <yomguy@457c0346-1240-4656-8a5a-9edca8063506>
Fri, 24 Jul 2009 09:51:56 +0000 (09:51 +0000)
git-svn-id: http://svn.parisson.org/svn/tools/trunk@69 457c0346-1240-4656-8a5a-9edca8063506

various/date_filter.py [new file with mode: 0755]

diff --git a/various/date_filter.py b/various/date_filter.py
new file mode 100755 (executable)
index 0000000..e8770af
--- /dev/null
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+
+import os,  time, sys
+
+root = sys.argv[1] # one specific folder
+
+date_file_list = []
+for root, dirs, files in os.walk(root):
+    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_list.append(date_file_tuple)
+
+date_file_list.sort()
+date_file_list.reverse() # newest mod date now first
+
+print "%-40s %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("%m/%d/%y %H:%M:%S", file[0])
+        #print "%-40s %s" % (file_name, file_date)
+        print "%-40s %s" % (file[1], file_date)