首页 > 开发 > Linux Shell > 正文

linux中批量修改文件名的脚本代码

2020-07-27 19:26:50
字体:
来源:转载
供稿:网友
使用 rename 命令
========================
NAME
rename - Rename files

SYNOPSIS
rename from to file...
========================
复制代码 代码如下:

#! /bin/sh
INIFILE="./dirlist.ini"
CURPATH=$(pwd)
for SERVERPATH in $(cut -d: -f1 $INIFILE)
do
cd $SERVERPATH
cd ani
/usr/bin/rename .ANI .ani *
/usr/bin/rename .A?? .ani *
/usr/bin/rename .?N? .ani *
/usr/bin/rename .??I .ani *
cd ..
cd map
MAPPATH=$(pwd)
for maplist in $(ls -1)
do
cd ${MAPPATH}/${maplist}
/usr/bin/rename .yom .YOM *
/usr/bin/rename .y?? .YOM *
/usr/bin/rename .?o? .YOM *
/usr/bin/rename .??m .YOM *
done
cd $CURPATH
done
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表