教程集 www.jiaochengji.com
教程集 >  脚本编程  >  shell  >  正文 递归修改目录与文件名统一为小写的shell脚本

递归修改目录与文件名统一为小写的shell脚本

发布时间:2014-10-05   编辑:jiaochengji.com
shell脚本实现递归修改一个目录下的所有文件与子目录名统一为小写,有需要的朋友,建议参考下。

代码如下:
 

复制代码 代码示例:
#!/bin/bash
# modify directory and file
# rename new name
# by http://www.jiaochengji.com
let i=1
max=$(find | sed 's#[^/]##g' | sort -r | head -1 | wc -c)
while [ $i -lt $max ]
 do find -mindepth $i -maxdepth $i -name '*[A-Z]*' | while read file; do mv $file `echo $file|tr 'A-Z' 'a-z'`; done
 let i++
done

您可能感兴趣的文章:
递归修改目录与文件名统一为小写的shell脚本
python shell是什么
shell批量修改文件后缀名
Linux目录递归改变文件名大小写的shell
动态网页制作规范
inux shell初级入门教程
linux shell脚本编程基础教程
Linux Source命令解析
web安全之文件上传漏洞攻击与防范方法
asp实现的代码批量修改程序

[关闭]
~ ~