Skip to content

Instantly share code, notes, and snippets.

@stepango
Created October 2, 2019 02:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stepango/8e86994e3b89b5a46020c2100d329510 to your computer and use it in GitHub Desktop.
Save stepango/8e86994e3b89b5a46020c2100d329510 to your computer and use it in GitHub Desktop.
Find all empty R.java files
import os
path = os.path.dirname(os.path.realpath(__file__))
pattern = """public final class R {
private R() {}
}"""
# r=root, d=directories, f = files
for r, d, f in os.walk(path):
for file in f:
if 'R.java' == file:
fullPath = os.path.join(r, file)
s = open(fullPath, 'r').read()
if pattern in s:
print(os.path.join(r, file))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment