从命令行重命名文件
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了从命令行重命名文件相关的知识,希望对你有一定的参考价值。
A couple of snippets useful for file management. I use these to make sure I understand how many files I'm about to modify, and then rename them.
## Use find to search for the files I want recursively from the current path ## Powerful utility, man find to read the man pages find . -type f # Find all regular files ## I can use wc (word count) with the -l flag to count the number of returned lines find . -name "*.rhtml" | wc -l # Count the number of files that match ## I can then add a while and mv command to rename the files find . -name "*.rhtml" | while read f; do mv ./"$f" "${f%rhtml}html.erb"; done
以上是关于从命令行重命名文件的主要内容,如果未能解决你的问题,请参考以下文章