zoukankan      html  css  js  c++  java
  • 常用的shell脚本

    // 查找某类文件,并集中cp 到指定目录

    find ./  -type f -name '*.png' -exec cp -fr {} ~/Desktop/xz-temp/ ;

    查找不使用的图片

    PROJ=`find . -name '*.xib' -o -name '*.[mh]'`

    find ./Resources -name "*.png"

        |while read line;do

        line=`basename $line`

        if echo "$line" | grep -q "2x" ; then

             iname=${line%%@*}

    [ -z "`find ./ ( -name "*.m" -or -name "*.h" )|xargs grep -E "${iname}"`" ] && echo $line;

        else

             iname=${line%%.*}

    [ -z "`find ./ ( -name "*.m" -or -name "*.h" )|xargs grep -E "${iname}"`" ] && echo $line;

        fi

        done

    ---

    查找不使用的图片

    #!/bin/sh

    echo "过滤结果如下:" > ~/Desktop/unused_all_images.txt

    # 查找这些类型的文件
    find $1 -type f  -name '*.xib' -o -name '*.[mh]' -o -name '*.json' -o -name '*.sh'  > ~/Desktop/tmp_all_files.txt

    for png in `find $1 -type f -name '*.png'`
    do
        # 不过滤 .bundle下的
        if [[ "$png" =~ ".bundle" ]]; then
            continue
        fi

        name=`basename $png .png`
        empty=""
        if [[ "$name" =~ "@2x" ]] || [[ "$name" =~ "@3x" ]]; then
            name=${name/@2x/$empty}
        fi

        #echo "xzoscar:${name}"

        isfound=0
        while read line
        do
          if grep "${name}" "${line}"; then
             isfound=1
             break
          fi
        done < ~/Desktop/tmp_all_files.txt

        if [ $isfound -eq 0 ]; then
           echo "$name is not referenced"  >> ~/Desktop/unused_all_images.txt
        fi

    done

  • 相关阅读:
    javascript 3秒钟后自动跳转到前一页面
    meta
    HTML 5 label
    WCF的ABC
    由于 Web 服务器上的“ISAPI 和 CGI 限制”列表设置,无法提供您请求的页面。
    ECMASCRIPT5新特性(转载)
    bin目录正.pdb是什么文件?
    PS切图的相关技巧
    MongoVUE破解方法
    ASP.NET MVC Area操作
  • 原文地址:https://www.cnblogs.com/xzoscar/p/4949504.html
Copyright © 2011-2022 走看看