删除android 开发路径下无用的图片资源的脚本
程序员文章站
2022-05-03 17:57:31
find_not_ref()
{
find res -name "*.$1" | grep -e "(drawable|anim)" | sed...
find_not_ref() { find res -name "*.$1" | grep -e "(drawable|anim)" | sed -e "s/.*\/\([a-z0-9_]*\)\..*/\1/g" | sort | uniq > /tmp/file.txt while read line do javawl=`find . -name "*.java" | xargs grep "\.$line" | wc -l` xmlwl=`find . -name "*.xml" | xargs grep "/$line" | wc -l` total="$javawl$xmlwl" if [[ $total == "00" ]]; then find res -name"*$line.$1" find res -name"*$line.$1" | xargs rm -f fi done < /tmp/file.txt } find_not_ref "xml" find_not_ref "png" find_not_ref "jpg"