我需要重命名多个文件,但增量为.5。任何想法?
EX:
rm -rf node_modules platforms
提前致谢
答案 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