首页 > 系统服务 > 详细

shell批量重命令文件脚本

时间:2015-11-13 17:06:50      阅读:245      评论:0      收藏:0      [点我收藏+]

批量重命名脚步记录,以备用

假如有一批11.txt 12.txt 13,txt 14.txt 15.txt脚步要要重命名为1.txt 2.txt 3.txt ....

脚本如下:

#!/bin/bash
count=1
for i in *.txt
do
 new=$count.${i#*.}
 mv $i $new
 if [ $? -eq 0 ]
  then echo "renaming $i to $new"
  let count++
 fi
done

 

shell批量重命令文件脚本

原文:http://www.cnblogs.com/landhu/p/4962605.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!