Skip to content

Instantly share code, notes, and snippets.

@neonichu
Created February 6, 2012 16:30
Show Gist options
  • Select an option

  • Save neonichu/1753128 to your computer and use it in GitHub Desktop.

Select an option

Save neonichu/1753128 to your computer and use it in GitHub Desktop.
Quick and dirty script for finding image resources in an Xcode project folder
#!/bin/sh
## Quick and dirty script for finding image resources in an Xcode project folder
for ext in jpg jpeg png
do
matches=`grep -r "\.$ext" *|grep -v '\.xcodeproj'`
IFS=$'\n'
for match in $matches
do
file=`echo $match|cut -d: -f-1`
echo $match|grep '\.m:' >/dev/null 2>&1
if [ $? -eq 0 ]
then
match=`echo $match|sed "s/.*\"\(.*\.$ext\)\".*/\1/"`
echo "$match ($file)"
continue
fi
echo $match|grep '\.xib:' >/dev/null 2>&1
if [ $? -eq 0 ]
then
match=`echo $match|sed "s/.*>\(.*\.$ext\)<.*/\1/"`
echo "$match ($file)"
continue
fi
echo "Unhandled file '$file'" >&2
exit 1
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment