Skip to content

Instantly share code, notes, and snippets.

@Hayao0819
Last active January 31, 2024 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hayao0819/4477cc1c67a6349c22fa255edab2c44a to your computer and use it in GitHub Desktop.
Save Hayao0819/4477cc1c67a6349c22fa255edab2c44a to your computer and use it in GitHub Desktop.
同じフォルダの重複ファイルを表示する
# CC0
# https://creativecommons.org/publicdomain/zero/1.0/legalcode.txt
import os
import hashlib
hashlist = []
for file in sorted(os.listdir("."), reverse=True):
if os.path.isfile(file):
with open(file, "rb") as f:
data = f.read()
sha1 = "" # Todo: sha1を計算する
if sha1 in hashlist:
print(file + "は重複しています")
else:
hashlist.append(sha1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment