changeset 407:a8982ae84a9b

disaster recovery
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 04 Aug 2013 08:55:32 -0700
parents 38dd72d72086
children 705dc5cfd68d
files python/directories.py
diffstat 1 files changed, 30 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/python/directories.py	Sun Aug 04 08:55:32 2013 -0700
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+
+"""
+ls unique file paths
+"""
+
+import optparse
+import os
+import sys
+
+here = os.path.dirname(os.path.realpath(__file__))
+
+def main(args=sys.argv[1:]):
+
+    usage = '%prog [options]'
+    parser = optparse.OptionParser(usage=usage, description=__doc__)
+    parser.add_option('--strip', default='? ')
+    options, args = parser.parse_args(args)
+
+    _input = sys.stdin.read()
+    lines = [i.strip() for i in _input.splitlines()
+             if i.strip()]
+    lines = [i[len(options.strip):] if i.startswith(options.strip) else i
+             for i in lines]
+    paths = set([i.split(os.path.sep)[0] for i in lines])
+    for i in sorted(paths):
+        print i
+
+if __name__ == '__main__':
+    main()