Last active
August 7, 2018 04:09
-
-
Save diewland/cb4605c25bbbbc0aceb01c823f5e688f to your computer and use it in GitHub Desktop.
Check duplicate file size
This file contains hidden or 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
import os | |
import sys | |
from pprint import pprint as pp | |
path = sys.argv[1] | |
size_dict = {} | |
for _, _, files in os.walk(path): | |
for f in files: | |
size = os.path.getsize("%s/%s" % (path, f)) | |
v = size_dict.get(size, []) | |
v.append(f) | |
size_dict[size] = v | |
out = [ v for k, v in size_dict.items() if len(v) > 1 ] | |
pp(out) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment