Skip to content

Instantly share code, notes, and snippets.

@mcomisso
Created August 1, 2015 19:18
Show Gist options
  • Save mcomisso/5ee44759856167f1e70d to your computer and use it in GitHub Desktop.
Save mcomisso/5ee44759856167f1e70d to your computer and use it in GitHub Desktop.
Remove app downloaded with a different account
#! /usr/local/bin/python
import zipfile, os
for zip_app_name in os.listdir("/Path/to/Music/iTunes/iTunes Music/Mobile Applications"):
if os.path.isdir(zip_app_name) or not zip_app_name.endswith('.ipa'):
continue
workflow = zipfile.ZipFile(zip_app_name)
try:
f = workflow.open("iTunesMetadata.plist")
if not 'your_email@domain.com' in f.read():
f.close
print "Removing ", zip_app_name
os.remove(zip_app_name)
else:
f.close
except:
continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment