diff python/randomize.py @ 0:f3ab51c79813

adding configuration from https://svn.openplans.org/svn/config_jhammel/
author k0s <k0scist@gmail.com>
date Thu, 15 Oct 2009 11:41:26 -0400
parents
children 12299cbc45ee
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/python/randomize.py	Thu Oct 15 11:41:26 2009 -0400
@@ -0,0 +1,27 @@
+#!/usr/bin/env python
+
+import os
+import random
+import subprocess
+import sys
+
+from optparse import OptionParser
+
+if __name__ == '__main__':
+    parser = OptionParser()
+    parser.add_option("-e", "--exec", dest="callable",
+                      help="program to execute")
+    (options, argv) = parser.parse_args()
+    args = []
+    for i in argv:
+        if os.path.isdir(i):
+            for root, dirs, files in os.walk(i):
+                args.extend([os.path.join(root, f) for f in files])
+        else:
+            args.append(i)
+    random.shuffle(args)
+    if options.callable:
+        for i in args:
+            subprocess.call([options.callable, i])
+    else:
+        print '\n'.join(args)