mirror of
https://github.com/xzb23/check_duplicate_files.git
synced 2026-11-24 18:45:31 +08:00
fix: 在文件总数小于100的检查中崩溃
This commit is contained in:
1 file changed
+2
-1
@@ -16,6 +16,7 @@ def traverse_dir(root_dir):
|
|||||||
def hash_files_from_glist(algorithm: function):
|
def hash_files_from_glist(algorithm: function):
|
||||||
print("正在计算文件散列ing...")
|
print("正在计算文件散列ing...")
|
||||||
i = 0
|
i = 0
|
||||||
|
p_old_i = -1
|
||||||
for f_path in runing_data.file_path_list:
|
for f_path in runing_data.file_path_list:
|
||||||
with open(f_path, "rb") as f:
|
with open(f_path, "rb") as f:
|
||||||
f_hash = hashlib.file_digest(f, algorithm)
|
f_hash = hashlib.file_digest(f, algorithm)
|
||||||
@@ -25,7 +26,7 @@ def hash_files_from_glist(algorithm: function):
|
|||||||
if i % config.wait_c == 0:
|
if i % config.wait_c == 0:
|
||||||
p_old_i = i
|
p_old_i = i
|
||||||
print(f"\r{i}/{len(runing_data.file_path_list)}", end="")
|
print(f"\r{i}/{len(runing_data.file_path_list)}", end="")
|
||||||
if i != p_old_i:
|
if p_old_i != -1 and i != p_old_i:
|
||||||
print(f"\r{i}/{len(runing_data.file_path_list)}", end="")
|
print(f"\r{i}/{len(runing_data.file_path_list)}", end="")
|
||||||
print()
|
print()
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user