当前位置: 技术问答>linux和unix
在UNIX下怎么进行文件的批量命名???
来源: 互联网 发布时间:2015-07-17
本文导语: 用的系统sun solaris,想对文件进行重命名,文件数目很多,格式都是统一的 (如:aaa20040820bbb.ccc),现在想命名为aaa20040819bbb.ccc。谢谢了 | step 1: writing the following codes into a file trans.sh step 2:...
用的系统sun solaris,想对文件进行重命名,文件数目很多,格式都是统一的
(如:aaa20040820bbb.ccc),现在想命名为aaa20040819bbb.ccc。谢谢了
(如:aaa20040820bbb.ccc),现在想命名为aaa20040819bbb.ccc。谢谢了
|
step 1: writing the following codes into a file trans.sh
step 2: setting execution privilege for this file by chmod +x trans.sh command.
step 3: running trans.sh
# trans.sh
files=`ls /your file directory`
for f in $fils
do
nf=`echo echo $f | sed -s s/2004824/20040824/`
mv $f $nf
done
step 2: setting execution privilege for this file by chmod +x trans.sh command.
step 3: running trans.sh
# trans.sh
files=`ls /your file directory`
for f in $fils
do
nf=`echo echo $f | sed -s s/2004824/20040824/`
mv $f $nf
done