×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Bash
Posted by: Jing Tai Piao
Added: Sep 10, 2012 4:55 AM
Views: 23
Tags: no tags
A Bash Script To Find Unused Images in a Project?
  1. #!/bin/bash
  2.  
  3. MYPATH=$1
  4.  
  5. find "$MYPATH" -name *.jpg -exec basename {} \; > /tmp/patterns
  6. find "$MYPATH" -name *.png -exec basename {} \; >> /tmp/patterns
  7. find "$MYPATH" -name *.gif -exec basename {} \; >> /tmp/patterns
  8.  
  9. for p in $(cat /tmp/patterns); do
  10.     grep -R $p "$MYPATH" > /dev/null || echo $p;
  11. done