Created
August 27, 2015 07:12
-
-
Save 0guzhan/47edfb488d9d6dfe56dd to your computer and use it in GitHub Desktop.
Removing unused resources in android project with using lint
This file contains 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/python | |
import os | |
# lint --check UnusedResources . > C:\lint.txt | |
# extract unused resource file paths from lint.txt to candidates.txt | |
# honestly I used excel :) | |
prefix = 'C:\\Users\\myuser\\git\\my-project-repo\\my-web-project' | |
print(prefix) | |
print(os.path.exists(prefix)) | |
print(os.path.isfile(prefix)) | |
with open('candidates.txt') as fo: | |
for line in fo: | |
line = line.rstrip('\n') | |
path = prefix + line | |
if os.path.exists(path): | |
os.remove(path) | |
print("removed:", path) | |
else: | |
print("not exists:", path) | |
# Close opend file | |
fo.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment