Skip to content

Instantly share code, notes, and snippets.

@harshraj8843
Created June 28, 2022 06:12
Show Gist options
  • Save harshraj8843/2a159f9154cea36d691da11e38886965 to your computer and use it in GitHub Desktop.
Save harshraj8843/2a159f9154cea36d691da11e38886965 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
# find files with same extension inside sub-directories
import os
extensions = ['.c', '.cpp', '.cs', '.java', '.py', '.go', '.php']
for ext in extensions:
dc = fc = 0
for _, _, fs in os.walk('.'):
c = sum(f.endswith(ext) for f in fs)
if c > 1:
for f in fs:
if f.endswith(ext):
print(f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment