Created
February 6, 2012 16:30
-
-
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
This file contains hidden or 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 | |
| ## 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