I want to delete all the unused images from a XCode project and in order to do that I am using the following script:
#!/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
rm –Rf "$png"
echo "$png is not referenced"
fi
done
The above script is working fine and deleting all the images from the project that are not referenced in ".xib" however, there is a catch.
Problem
The script is also deleting the images that are referenced in ".m" files. (Images that are getting set programmatically)
Request
Could you please tell me how can I add ".m" with ".xib" files in search.
PROJ=`find . -name '*.xib’ -o -name '*.[mh]'`