You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.1 KiB
37 lines
1.1 KiB
from getFiles import get_file_list |
|
from getMd5 import get_file_md5 |
|
from db import * |
|
|
|
|
|
def main_process(): |
|
disk = "Myxx_Backup_16T_2" |
|
cate = "hj" |
|
path = r"Y:\hj" |
|
|
|
_exist_file_list = [] |
|
|
|
if disk == "" or cate == "" or path == "": |
|
print("检查参数") |
|
return |
|
|
|
file_list = get_file_list(path) |
|
file_list_len = len(file_list) |
|
for (i, f) in enumerate(file_list): |
|
print(f"({i+1}/{file_list_len}) - 开始处理: {f}") |
|
if md5 := get_md5_by_path(f): |
|
print(f"请注意!!!文件的md5({md5})已经存在: {f}") |
|
else: |
|
md5 = get_file_md5(f) |
|
if exist := is_exist(md5): |
|
_exist_file_list.append(f) |
|
print(f"重复文件!!!md5为({md5})的文件已经存在,文件路径:{exist['path']} -> {f}") |
|
continue |
|
insert_data((cate, disk, f, md5)) |
|
print(f"文件的md5({md5})成功插入: {f}") |
|
return _exist_file_list |
|
|
|
|
|
if __name__ == "__main__": |
|
exist_file_list = main_process() |
|
for ef in exist_file_list: |
|
print(ef)
|
|
|