Skip to content

Instantly share code, notes, and snippets.

@TBonnin
Created October 2, 2012 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TBonnin/3822432 to your computer and use it in GitHub Desktop.
Save TBonnin/3822432 to your computer and use it in GitHub Desktop.
Unused images
#!/bin/bash
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
for i in `find . -name "*.png" -o -name "*.jpg"`; do
file=`basename -s .jpg "$i" | xargs basename -s .png | xargs basename -s @2x`
result=`ack -i "$file"`
if [ -z "$result" ]; then
echo "$i"
fi
done
# Ex: to remove from git
# for i in `./script/unused_images.sh`; do git rm "$i"; done
IFS=$SAVEIFS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment