Created
January 6, 2013 18:33
-
-
Save sahib/4469289 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# encoding: utf-8 | |
import sys | |
import os | |
def finish(data_set): | |
base_names = {} | |
for dup in data_set: | |
base_names.setdefault(os.path.basename(dup), []).append(dup) | |
for basename, full_paths in base_names.items(): | |
if len(full_paths) > 1: | |
print('\n#' + ' ' + basename) | |
for path in full_paths: | |
print(path) | |
if __name__ == '__main__': | |
if len(sys.argv) > 1: | |
dups_list = [] | |
with open(sys.argv[1], 'r') as f: | |
for line in f: | |
if 'DUPL' in line: | |
split = line.split('//') | |
if len(split) > 2: | |
dups_list.append(split[2]) | |
finish(dups_list) | |
else: | |
print('''Usage: {name} /path/to/rmlint.log | |
Parse rmlint.log and print all dups that have double basenames.'''.format(name=sys.argv[0])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment