Skip to content

Instantly share code, notes, and snippets.

@0guzhan
Created August 27, 2015 07:12
Show Gist options
  • Save 0guzhan/47edfb488d9d6dfe56dd to your computer and use it in GitHub Desktop.
Save 0guzhan/47edfb488d9d6dfe56dd to your computer and use it in GitHub Desktop.
Removing unused resources in android project with using lint
#!/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