def getting_directory(path,create): '''Получение словаря с дубликатами''' directory = FullDirectoryListing() directory(path) files = {} for file in directory.fullpath: if file.find('.md5') > 0: continue try: files[file] = (create_checksum(file,create)) except FileNotFoundError: continue xsum = [] xdup = [] for val in files.values(): xsum.append(val) for val in xsum: if xsum.count(val) > 1: xdup.append(val) dup_file_names = {} for val in xdup: for filename in files.keys(): if files[filename] == val: if val not in dup_file_names.keys(): dup_file_names.update({val: []}) dup_file_names[val].append(filename) return dup_file_names
def findDupes(path = '/tmp'): dup = [] record = {} d = diskwalk(path) files = d.enumeratePaths() for file in files: compound_key = (getsize(file),create_checksum(file)) if compound_key in record: dup.append(file) else: record[compound_key] = file return dup
def findDupes(path): record = {} dup = {} d = diskwalk(path) files = d.paths() for file in files: compound_key = (getsize(file),create_checksum(file)) if compound_key in record: dup[file] = record[compound_key] else: record[compound_key]=file return dup
def findDupes(path='/tmp'): dup = [] record = {} d = diskwalk(path) files = d.enumreatePaths() for file in files: compound_key = (getsize(file), create_checksum(file)) if compund_key in record: dup.append(file) else: record[compound_key] = file return dup
def finddup(path): d = diskwalk(path) paths = d.enumeratepaths() record = {} dup = [] for p in paths: key = create_checksum(p) if key in record: dup.append(p) else: record[key] = p return dup
def findDups(path): d = diskwalk(path) files = d.enumeratePaths() dup = [] record = {} for file in files: compound_key = (os.path.getsize(file), create_checksum(file)) print compound_key if compound_key in record: dup.append(file) else: record[compound_key] = file return dup
def findDupes(path = "/home/simon/Downloads"): dup = [] record = [] d = diskwalk(path) files = d.enumeratepaths() for file in files: compound_key = (getsize(file), create_checksum(file)) if compound_key in record: dup.append(file) else: record.append(compound_key) #record[compound_key] = file return dup
def findDupes(path=sys.argv[1]): print path dup = [] record = {} d = diskwalk(path) print '*' * 70 for file in d: compound_key = (os.path.getsize(file), create_checksum(file)) if compound_key in record: dup.append(file) else: record[compound_key] = file return dup
def findDups(path): d = diskwalk(path) files = d.enumeratePaths() dup = [] record = {} for file in files: compound_key = (os.path.getsize(file),create_checksum(file)) print compound_key if compound_key in record: dup.append(file) else: record[compound_key] = file return dup
def findDupes(path=sys.argv[1]): print path dup = [] record = {} d = diskwalk(path) print '*'*70 for file in d: compound_key = (os.path.getsize(file),create_checksum(file)) if compound_key in record: dup.append(file) else: record[compound_key]=file return dup
def ProcessFile(Filename, Filelist=[]): """ Calculates MD5 sum and compares it with the supplied list returns a dictionary with 'md5' sum, 'dupplicates' list """ md5 = create_checksum(Filename) Duplicates = [] for i in range(len(Filelist)): if Filelist[i]["md5"] == md5: Duplicates.append(i) return {"md5": md5, "duplicates": Duplicates}
def find_dupes(path='tmp'): dups = [] record = {} d = DiskWalk(path) files = d.paths for file in files: compound_key = (getsize(file), create_checksum(file)) if compound_key in record: dups.append(file) else: record[compound_key] = file return dups
def find_dupes(path = '/tmp'): dup = [] record = {} files = diskwalk(path).enumerate_paths() for file in files: try: compound_key = (getsize(file), create_checksum(file)) if compound_key in record: dup.append(file) else: #print 'Creating compound_key record:', compound_key record[compound_key] = file except: pass return dup
def find_dupes(path='/tmp'): dup = [] record = {} files = diskwalk(path).enumerate_paths() for file in files: try: compound_key = (getsize(file), create_checksum(file)) if compound_key in record: dup.append(file) else: #print 'Creating compound_key record:', compound_key record[compound_key] = file except: pass return dup
def findDupes(path = '/tmp'): dup = [] ErrorFiles = [] record = {} d = diskwalk(path) files = d.enumeratePaths() for file in files: try: compound_key = (getsize(file),create_checksum(file)) if compound_key in record: dup.append(file) else: #print "Creating compound key record:", compound_key record[compound_key] = file except OSError, e: ErrorFiles.append(file)
def findDupes(path='/tmp'): dup = [] record = {} d = diskwalk(path) files = d.enumeratePaths() for file in files: compound_key = (getsize(file),create_checksum(file)) if compound_key in record: dup.append(file) else: record[compound_key] = file return dup if __name__ =="__main__": dupes = findDupes() for dup in dupes: print "Duplicate:%s" % dup
def fidnDupes(path='/'): dup = [] record = {} d = diskwalk(path) files = d.enumeratePaths() for file in files: compound_key = (getsize(file), create_checksum(file)) if compound_key in record: dup.append(file) else: #print "Creating compound key record:", compound_key record[compound_key] = file return dup if __name__ == "__main__": dupes = findDupes() for dup in dupes: print "Duplicate: %s" % dup
#!/usr/bin/env python from checksum import create_checksum if create_checksum('file1') == create_checksum('file2'): print 'same' else: print 'diff'