21 lines
631 B
Python
Executable file
21 lines
631 B
Python
Executable file
#!/usr/bin/env python3
|
|
|
|
import os
|
|
import os.path
|
|
import pprint
|
|
from collections import Counter
|
|
|
|
base_path = '/opt/music/alternatives'
|
|
|
|
possible_dupes = Counter({})
|
|
|
|
for sub_path in os.listdir(base_path):
|
|
for root, dirs, files in os.walk(os.path.join(base_path, sub_path)):
|
|
for file in files:
|
|
to_check = os.path.join(root, os.path.splitext(file)[0])
|
|
to_check = to_check.lower() # make the check case insensitive
|
|
possible_dupes.update([to_check,]) # ensure counter doesnt unpack a path string into distinct letters
|
|
|
|
duplicates = {key:value for key, value in possible_dupes.items() if value > 1}
|
|
pprint.pprint(duplicates)
|