Skip to content

Instantly share code, notes, and snippets.

@danielctull
Created October 12, 2011 07:36
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save danielctull/1280542 to your computer and use it in GitHub Desktop.
Save danielctull/1280542 to your computer and use it in GitHub Desktop.
A script to find images that are not used in an iOS project. Originally from http://stackoverflow.com/questions/6113243/how-to-find-unused-images-in-an-xcode-project
#!/bin/sh
PROJ=`find . -name '*.xib' -o -name '*.[mh]'`
for png in `find . -name '*.png'`
do
name=`basename $png`
if ! grep -q $name $PROJ; then
echo "$png is not referenced"
fi
done
@Abizern
Copy link

Abizern commented Oct 26, 2011

Just a note - this will flag up a lot of false positives with the retina graphics as they aren't referenced directly in the code. Only consider deleting an @2x file if its corresponding non retina version is also flagged as being unused.

Also - names with spaces in them are not displayed properly in the output.

@dimohamdy
Copy link

did you have an idea to enhancement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment