您可以用来
find递归查找所有匹配文件:
$ find . -iname "*dbg*" -exec rename _dbg.txt .txt '{}' ;编辑: 什么
'{}'和;是谁?
该
-exec参数使find
rename对找到的每个匹配文件执行。
'{}'将被替换为文件的路径名。最后一个标记;仅用于标记exec表达式的结尾。
手册页中对找到的所有内容进行了很好的描述:
-exec utility [argument ...] ; True if the program named utility returns a zero value as its exit status. Optional arguments may be passed to the utility. The expression must be terminated by a semicolon (``;''). If you invoke find from a shell you may need to quote the semicolon if the shell would otherwise treat it as a control operator. If the string ``{}'' appears anywhere in the utility name or the argu- ments it is replaced by the pathname of the current file. Utility will be executed from the directory from which find was executed. Utility and arguments are not subject to the further expansion of shell patterns and constructs.


