summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2014-01-07 15:03:49 +0100
committerFlorian Bruhin <git@the-compiler.org>2014-01-07 15:03:49 +0100
commit0f2f2510942be6289de7fb1a16927b9c283698bd (patch)
tree1d0b8b1aa1cd40431e94df22bb57dcfd4df3c1e8
parent20c117e3dcbf73152727d13dc7da5750db5c91fc (diff)
downloadpyrmlint-0f2f2510942be6289de7fb1a16927b9c283698bd.tar.gz
pyrmlint-0f2f2510942be6289de7fb1a16927b9c283698bd.zip
Add bigdupes.py and stats.py
-rwxr-xr-xbigdupes.py26
-rw-r--r--stats.py13
2 files changed, 39 insertions, 0 deletions
diff --git a/bigdupes.py b/bigdupes.py
new file mode 100755
index 0000000..67e70ec
--- /dev/null
+++ b/bigdupes.py
@@ -0,0 +1,26 @@
+import sys
+import pyrmlint
+
+def humansize(num):
+ for x in ['bytes','KB','MB','GB','TB']:
+ if num < 1024.0:
+ return "%3.1f %s" % (num, x)
+ num /= 1024.0
+
+r = pyrmlint.Logreader()
+r.parsefile(sys.argv[1])
+
+waste = []
+
+for pair in r.duplicates:
+ w = pair[0].size * (len(pair) - 1)
+ waste.append((w, pair))
+
+waste.sort(key=lambda elem: elem[0])
+#waste.reverse()
+
+for (size, pair) in waste:
+ print('=== {} ({}) ==='.format(humansize(size), size))
+ for fobj in pair:
+ fobj.printpath()
+ print()
diff --git a/stats.py b/stats.py
new file mode 100644
index 0000000..a8284ba
--- /dev/null
+++ b/stats.py
@@ -0,0 +1,13 @@
+#!/usr/bin/python
+
+import sys
+import pyrmlint
+
+r = pyrmlint.Logreader()
+r.parsefile(sys.argv[1])
+
+print("Blank files:")
+print(" {} files".format(len(r.data['BLNK'])))
+print()
+print("Old tmp files:")
+print(" {} files".format(len(r.data['BLNK'])))