linux中批量修改文件名的脚本代码
程序员文章站
2023-09-28 09:59:48
使用 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
========================
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