Skip to content

Instantly share code, notes, and snippets.

@pepicrft
Created September 29, 2013 22:22
Show Gist options
  • Save pepicrft/6757129 to your computer and use it in GitHub Desktop.
Save pepicrft/6757129 to your computer and use it in GitHub Desktop.
Delete all resources generated by "Unused.app". This app find all unused assets in your project and generates a text file with all of them. Thanks to this Python script you'll be able to clean them.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
if __name__ =='__main__':
if len(sys.argv) != 2:
print 'Filename with files to delete required as input parameter'
else:
try:
#Opening file to read files to backup
f=open(sys.argv[1],'r')
for line in f:
line=line[:-1] if line.endswith('\n') else line
#Getting the filename
filename = os.path.split(line)[-1]
#Deleting the file
os.remove(line)
print 'Deleted file: '+filename
except Exception, e:
print 'Exception: '+ str(e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment