用特定的格式重命名当前目录的图像文件,脚本如下:
复制代码 代码如下:
#!/bin/bash
#Filename:rename_photo.sh
set -x
count=1
for img in *.jpg *.png
do
new=image-$count.${img##*.}
mv "$img" "$new" 2> /dev/null
if [ $? -eq 0 ]
then
echo "Renameing $img to $new"
let count++
fi
done
其他的执行重命名的命令:rename
复制代码 代码如下:
[root@localhost script]# rename image photo image*
将当前目录下所有以image开头的文件,换成以photo开关
[root@localhost rename]# ls
image_1.jpg image_2.jpg image_3.jpg image_4.jpg image_5.jpg
[root@localhost rename]# rename image photo image*
[root@localhost rename]# ls
photo_1.jpg photo_2.jpg photo_3.jpg photo_4.jpg photo_5.jpg
将扩展名小写的.jpg改为大写.JPG
[root@localhost rename]# rename .jpg .JPG *.jpg
[root@localhost rename]# ls
photo_1.JPG photo_2.JPG photo_3.JPG photo_4.JPG photo_5.JPG
最近发表
- Centos7 metasploit-framework安装部署
- 记录systemd内存占用过多
- 错误提示open_basedir restriction in effect. File is not within the allowed path:的解决方法
- EUserv自动续期shell脚本配合crontab
- Elasticsearch 7.9.1集群安装配置
- 判断磁盘空间使用率是否达到阈值shell脚本
- TypeError: Unicode-objects must be encoded before hashing
- Unverified HTTPS request is being made
- Centos7 部署DHCP服务
- LVS负载调度NAT及DR教程
标签列表
- win11 (20)
- win11教程 (20)
- win11桌面 (1)
- 远程桌面 (1)
- 远程链接 (1)
- 清理缓存 (1)
- Win11如何设置右键经典模式 (2)
- Win11右键怎么设置原来的模样 (2)
- Win11图标 (2)
- Win11 (4)
- 本地磁盘 (1)
- win11正式版退回win10 (1)
- win10 (1)
- 管理员权限 (1)
- 帝国cms教程 (36)
- 火焰效果 (2)
- 火焰制作 (2)
- 火焰动图 (2)
- ps教程 (9)
- Office 2010 (2)
- Office2010 (2)
- Office2010激活 (2)
- Office2007 (4)
- Office2007安装 (4)
- Office2007激活 (4)
