# # -*- coding: utf-8 -*-
# 思路:获取所有的文件,并且比较他们的md5,若是md5相同,则认为是相同文件,然后输出
import os
import hashlib
def getAllList(root_path,allfile):
file_path_list = os.listdir(root_path)
for file_path_name in file_path_list:
file_path = os.path.join(root_path,file_path_name)
# print(file_path,os.path.dirname(root_path))
if os.path.isdir(file_path) and 'build' not in os.path.dirname(file_path):
getAllList(file_path,allfile)
else :
if 'drawable' in os.path.basename(root_path):
allfile.append(file_path)
return allfile
# 读取文件中的所有内容
def findMd5(files):
md5list = {}
for filepath in files:
if os.path.isdir(filepath):
continue
md5obj = hashlib.md5()
fd = open(filepath, 'rb')
while True:
buff = fd.read(2048)
if not buff:
break
md