Created
February 19, 2019 03:04
-
-
Save pcqpcq/4471de1d55aecb057b55a11f79dde96c to your computer and use it in GitHub Desktop.
demo shell script. 重命名当前目录下所有数字视频文件名
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for file in ./* | |
do | |
fname=$(basename $file .mp4) #获取文件名 | |
expr $fname "+" 10 &> /dev/null # 判断是否数字 | |
if [ $? -eq 0 ];then # 判断是否数字 | |
name=$(($fname+98)) # 数字运算 | |
echo "$name is number" # log | |
mv $fname.mp4 $name.mp4 # 重命名 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment