def delete_identical_files():
for battle_folder in os.listdir(download_path):
battle_folder_path = os.path.join(os.curdir, download_folder_name, battle_folder)
if not battle_folder.startswith('.') and os.path.isdir(battle_folder_path):
battle_files = os.listdir(battle_folder_path)
previous_battle_file = os.path.join(os.curdir, "main.py")
for battle_file in battle_files:
current_battle_file = os.path.join(os.curdir, download_folder_name, battle_folder, battle_file)
if filecmp.cmp(previous_battle_file, current_battle_file, shallow=0):
os.remove(current_battle_file)
print current_battle_file, "Deleted, copy of another file"
else:
previous_battle_file = current_battle_file
print "Identical file search complete."
评论列表
文章目录