脚本去获取没有@2x图像的图像

  • 本文关键字:图像 @2x 获取 脚本 iphone
  • 更新时间 :
  • 英文 :


我想创建一个脚本,解析我所有的iPhone应用程序文件夹,并打印(导出到文件中)没有@2x图像的图像名称。

示例:

假设我们有:eaxmple.png,但我们没有example@2x.png=>它应该打印example.png,因为它没有example@2x.png在它的文件夹中。

你能给我一个好的开始方式吗?或者有什么提示吗?

谢谢。

您可以使用下一个bash脚本执行此任务

#!/bin/bash
FILES=`find . -name "*.png"`
for file in $FILES
do
  if [[ "$file" == *@2x.png ]]
  then
    continue
  fi
  RETINA_FILENAME=${file/.png/@2x.png}
  if test -e $RETINA_FILENAME;
  then
    continue
  fi
  echo $file
done

最新更新