Created
June 28, 2022 06:12
-
-
Save harshraj8843/2a159f9154cea36d691da11e38886965 to your computer and use it in GitHub Desktop.
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
#!/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