Last active
January 31, 2024 14:06
-
-
Save Hayao0819/4477cc1c67a6349c22fa255edab2c44a to your computer and use it in GitHub Desktop.
同じフォルダの重複ファイルを表示する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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