| 26 |
|
if self.reportType == 'Complex': |
| 27 |
|
hashVal = self.hasher.HashFile(os.path.join(currentDir, file)) |
| 28 |
|
self.hashMatrix[os.path.join(currentDir, file)] = hashVal |
| 29 |
< |
if file in self.matrix.keys(): |
| 29 |
> |
if file in list(self.matrix.keys()): |
| 30 |
|
self.matrix[file].append(os.path.join(currentDir, file)) |
| 31 |
|
else: |
| 32 |
|
self.matrix[file] = [os.path.join(currentDir, file)] |
| 33 |
|
def DuplicateReport(self): |
| 34 |
|
dupCount = NinoGenTools.Counter() |
| 35 |
|
|
| 36 |
< |
for i in self.matrix.keys(): |
| 36 |
> |
for i in list(self.matrix.keys()): |
| 37 |
|
instanceCount = len(self.matrix[i]) |
| 38 |
|
## Query these "Dups" against the hash table and remove them if they're not. |
| 39 |
|
|
| 40 |
|
if instanceCount > 1: |
| 41 |
|
dupCount.inc() |
| 42 |
< |
print "-"*25 |
| 43 |
< |
print "You have %d versions of %s" %(instanceCount, i) |
| 42 |
> |
print("-"*25) |
| 43 |
> |
print("You have %d versions of %s" %(instanceCount, i)) |
| 44 |
|
for dir in self.matrix[i]: |
| 45 |
< |
print dir |
| 46 |
< |
print "-"*25 |
| 47 |
< |
print |
| 48 |
< |
print "*"*25 |
| 49 |
< |
print "You have a total of %d duplicates" %dupCount.count |
| 45 |
> |
print(dir) |
| 46 |
> |
print("-"*25) |
| 47 |
> |
print() |
| 48 |
> |
print("*"*25) |
| 49 |
> |
print("You have a total of %d duplicates" %dupCount.count) |
| 50 |
|
|
| 51 |
|
|
| 52 |
|
class DirDictionaryComparisonTool: |
| 61 |
|
otherComputerMissingCount = NinoGenTools.Counter() |
| 62 |
|
localMissingFileList =[] |
| 63 |
|
otherMissingFileList =[] |
| 64 |
< |
for i in localComputer.matrix.keys(): |
| 65 |
< |
if i in otherComputer.matrix.keys(): |
| 64 |
> |
for i in list(localComputer.matrix.keys()): |
| 65 |
> |
if i in list(otherComputer.matrix.keys()): |
| 66 |
|
pass |
| 67 |
|
else: |
| 68 |
|
otherMissingFileList.append(i) |
| 69 |
< |
for x in otherComputer.matrix.keys(): |
| 70 |
< |
if x in localComputer.matrix.keys(): |
| 69 |
> |
for x in list(otherComputer.matrix.keys()): |
| 70 |
> |
if x in list(localComputer.matrix.keys()): |
| 71 |
|
pass |
| 72 |
|
else: |
| 73 |
|
localMissingFileList.append(x) |
| 74 |
|
|
| 75 |
< |
print "*"*25 |
| 76 |
< |
print "You are missing %d files, that the other computer has."%len(localMissingFileList) |
| 77 |
< |
print |
| 78 |
< |
raw_input("Press any key to see a list:") |
| 79 |
< |
print "-"*25 |
| 75 |
> |
print("*"*25) |
| 76 |
> |
print("You are missing %d files, that the other computer has."%len(localMissingFileList)) |
| 77 |
> |
print() |
| 78 |
> |
input("Press any key to see a list:") |
| 79 |
> |
print("-"*25) |
| 80 |
|
for fileName in localMissingFileList: |
| 81 |
|
for absFilePath in otherComputer.matrix[fileName]: |
| 82 |
< |
print absFilePath |
| 83 |
< |
print "-"*25 |
| 84 |
< |
print "*"*25 |
| 85 |
< |
print "The other computer is missing %d files, that you have."%len(otherMissingFileList) |
| 86 |
< |
print |
| 87 |
< |
raw_input("Press any key to see a list:") |
| 88 |
< |
print "-"*25 |
| 82 |
> |
print(absFilePath) |
| 83 |
> |
print("-"*25) |
| 84 |
> |
print("*"*25) |
| 85 |
> |
print("The other computer is missing %d files, that you have."%len(otherMissingFileList)) |
| 86 |
> |
print() |
| 87 |
> |
input("Press any key to see a list:") |
| 88 |
> |
print("-"*25) |
| 89 |
|
for fileName in otherMissingFileList: |
| 90 |
|
for absFilePath in localComputer.matrix[fileName]: |
| 91 |
< |
print absFilePath |
| 92 |
< |
print "-"*25 |
| 91 |
> |
print(absFilePath) |
| 92 |
> |
print("-"*25) |
| 93 |
|
|