Created
January 23, 2012 10:50
-
-
Save vibrazy/1662452 to your computer and use it in GitHub Desktop.
How to find unused images in an XCode project?
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
#!/bin/sh | |
# ------- | |
# Usage sh unusedImages.sh (jpg|png|gif) | |
# ------- | |
# Caveat | |
# 1 - | |
# NSString *imageName = [NSString stringWithFormat:@"image_%d.png", 1]; | |
# This script would incorrectly list these images as unreferenced. For example, you might have | |
# This script will incorrectly think image_1.png is unreferenced. | |
# 2 - If you have a method, or variable with the same name as the image it won't pick it up | |
PROJ=`find . -name '*.xib' -o -name '*.[mh]' -o -name '*.storyboard' -o -name '*.plist'` | |
for imageName in `find . -name '*.'$1` | |
do | |
name=`basename -s .$1 $imageName` | |
name=`basename -s @2x $name` | |
name=`basename -s ~ipad $name` | |
name=`basename -s @iPad $name` | |
if ! grep -q $name $PROJ; then | |
echo "$imageName" | |
fi | |
done |
how about the path include a space in it?
Pretty much useless when you have a space somewhere in your directory structure.
Getting no such file and directory multiple times. Not working for me. Any alternate solution?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
love it