OSX - 以.5增量重命名多个文件

时间:2016-12-09 18:01:25

标签: macos batch-rename

我需要重命名多个文件,但增量为.5。任何想法?

EX:

rm -rf node_modules platforms

提前致谢

1 个答案:

答案 0 :(得分:1)

#!/bin/bash

prefix="A-BCD-"
value=30
odd=false

for file in `ls -1 | sort`; do
    if [ "$odd" == "true" ]; then
          odd=false
          echo ${prefix}${value}.5.jpg
          # cp $file ${prefix}${value}.5.jpg
          let value=$value+1
        else
          odd=true
          echo ${prefix}${value}.jpg
          # cp $file ${prefix}${value}.5.jpg
        fi

done