Shell programming problem (Borne Shell or Korn Shell)How to change all files in a directory from one extension to another one? Thanks!
看看这个可以么?没在公司,不能测试
for example from *.abc to *.cde
source=`ls *.abc`
for file in $source
do
newfile=`echo $file | sed s'/.abc/.cde/g'`
#先不要用mv, 用echo看看$newfile名字对不,
#免得给你文件弄坏了
mv $file $newfile
done
source=`ls *.abc`
for file in $source
do
newfile=`echo $file | sed s'/.abc/.cde/g'`
#先不要用mv, 用echo看看$newfile名字对不,
#免得给你文件弄坏了
mv $file $newfile
done