What is Nostr?
Mathieu Comandon /
npub19k5…32lp
2024-03-12 00:45:41

Mathieu Comandon on Nostr: So many tools to find duplicates on Linux. None of them do import os import sys def ...

So many tools to find duplicates on Linux. None of them do

import os
import sys

def list_dir(path):
res = {}
for root, _, files in os.walk(path):
for file in files:
res[(file, os.stat(os.path.join(root, file)).st_size)] = root
return res

source = list_dir(sys.argv[1])
copy = list_dir(sys.argv[2])
for dupe in set(source.keys()).intersection(set(copy.keys())):
path = copy[dupe]
os.unlink(os.path.join(path, dupe[0]))
Author Public Key
npub19k58vq3ca6qz5xle7933vn3pyjcd4u2pxuhv42nvzxfygsejwrvs8c32lp