欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

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

程序员文章站 2022-06-02 13:00:24
使用 rename 命令 ======================== name rename - rename files synopsis rename from...
使用 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