This commit is contained in:
caiwx86 2024-10-28 12:50:50 +08:00
parent 4c44920af3
commit 63c63e30b6

View File

@ -10,12 +10,11 @@ def list_files_with_times(root_folder):
# 获取文件的最后修改时间
modification_time = os.path.getmtime(file_path)
# 格式化时间
# formatted_time = datetime.fromtimestamp(modification_time).strftime('%Y-%m-%d %H:%M:%S')
formatted_time = datetime.fromtimestamp(modification_time).strftime('%Y-%m-%d %H:%M:%S')
remove_time = datetime.fromtimestamp(modification_time).strftime('%Y-%m-%d')
if remove_time == "2024-10-28":
formatted_time = datetime.fromtimestamp(modification_time).strftime('%Y-%m-%d %H:%M:%S')
os.remove(file_path)
print(f"File: {file_path} | Last Modified: {formatted_time}")
print(f"File: {file_path} | Last Modified: {formatted_time}")
# 使用示例
root_folder = os.path.join(BASE_OUTPUT, 'CBZ/') # 替换为实际文件夹路径