|
|
@ -1,14 +1,20 @@ |
|
|
|
from getFiles import get_file_list |
|
|
|
import os |
|
|
|
|
|
|
|
import win32con |
|
|
|
|
|
|
|
import win32api |
|
|
|
|
|
|
|
from getFiles import get_file_list, remove_empty_folder |
|
|
|
from getMd5 import get_file_md5 |
|
|
|
from getMd5 import get_file_md5 |
|
|
|
from db import * |
|
|
|
from db import * |
|
|
|
from time import time as t |
|
|
|
from time import time as t |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
disk = ("Data_sjry" |
|
|
|
|
|
|
|
"" |
|
|
|
|
|
|
|
"" |
|
|
|
|
|
|
|
"") |
|
|
|
|
|
|
|
cate = "sjry" |
|
|
|
|
|
|
|
path = r"F:\Temp\sjry\2023-10" |
|
|
|
|
|
|
|
|
|
|
|
def main_process(): |
|
|
|
|
|
|
|
disk = "Myxx_Backup_16T_3" |
|
|
|
|
|
|
|
cate = "leshe" |
|
|
|
|
|
|
|
path = r"X:\leshe" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main_process(): |
|
|
|
_exist_file_list = [] |
|
|
|
_exist_file_list = [] |
|
|
|
|
|
|
|
|
|
|
|
if disk == "" or cate == "" or path == "": |
|
|
|
if disk == "" or cate == "" or path == "": |
|
|
@ -45,13 +51,20 @@ def main_process(): |
|
|
|
return _exist_file_list |
|
|
|
return _exist_file_list |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
|
def handle_exist(_exist_file_list): |
|
|
|
exist_file_list = main_process() |
|
|
|
if len(_exist_file_list) > 0: |
|
|
|
if len(exist_file_list) > 0: |
|
|
|
|
|
|
|
with open('dup.txt', 'w', encoding='utf-8') as dup_file: |
|
|
|
with open('dup.txt', 'w', encoding='utf-8') as dup_file: |
|
|
|
for ef in exist_file_list: |
|
|
|
for ef in _exist_file_list: |
|
|
|
print(ef) |
|
|
|
dup_file.write(ef + "\r\n") |
|
|
|
dup_file.write(ef) |
|
|
|
win32api.SetFileAttributes(ef, win32con.FILE_ATTRIBUTE_NORMAL) |
|
|
|
|
|
|
|
os.remove(ef) |
|
|
|
|
|
|
|
print(f"删除: {ef}") |
|
|
|
dup_file.close() |
|
|
|
dup_file.close() |
|
|
|
else: |
|
|
|
else: |
|
|
|
print("没有找到重复文件") |
|
|
|
print("没有找到重复文件") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
|
|
|
|
|
exist_file_list = main_process() |
|
|
|
|
|
|
|
handle_exist(exist_file_list) |
|
|
|
|
|
|
|
remove_empty_folder(path) |
|
|
|