Linux批量重命名文件 5 Replies 主要使用循环和sed,很简单的: for i in `ls`; do mv -f $i `echo $i | sed 's/str1/str2/'`; done 您可能也喜欢如下文章: PHP+MYSQL 两行Query搞定删除重复数据 编写shell脚本,使用iconv批量改变文件编码 自动输入用户名和密码用于telnet的shell, 哈哈
luw2007 2012-12-07 at 09:54 man rename EXAMPLES Given the files foo1, ..., foo9, foo10, ..., foo278, the commands rename foo foo0 foo? rename foo foo0 foo?? will turn them into foo001, ..., foo009, foo010, ..., foo278. And rename .htm .html *.htm will fix the extension of your html files. Reply ↓
其实有个命令叫 rename,就干这个用的…
恩。。学习了。。
嗯,这种简单的需求适合用rename
man rename
EXAMPLES
Given the files foo1, ..., foo9, foo10, ..., foo278,
the commands
rename foo foo0 foo?
rename foo foo0 foo??
will turn them into foo001, ..., foo009, foo010, ...,
foo278. And
rename .htm .html *.htm
will fix the extension of your html files.
恩。。刚发现。。