我想将我的Git项目中的所有erb文件重命名为haml.(比如index.html.erb到index.html.haml)
如果我重命名每个文件,我必须输入以下命令超过三十次.
$ git mv app/views/pages/index.html.erb app/views/pages/index.html.haml
Run Code Online (Sandbox Code Playgroud)
我尝试了下面的命令,但它没有用.
$ git mv app/views/**/*.erb app/views/**/*.haml
usage: git mv [options] <source>... <destination>
-n, --dry-run dry run
-f, --force force move/rename even if target exists
-k skip move/rename errors
Run Code Online (Sandbox Code Playgroud)
我怎样才能立刻重命名它们?
Bor*_*lid 28
for i in $(find . -iname "*.erb"); do
git mv "$i" "$(echo $i | rev | cut -d '.' -f 2- | rev).haml";
done
Run Code Online (Sandbox Code Playgroud)
对于每个.erb文件,git mv它自身的扩展名为".erb",替换为".haml".
使用 powershell 的单内衬
Dir *.erb -Recurse | foreach { git mv $_.FullName $_.FullName.replace("erb", "haml")}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4924 次 |
| 最近记录: |