0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

gitで複数ファイルの拡張子を一括置換するシェルスクリプト

Posted at

gitで、.jsを.tsに一括で置換したいときは以下のスクリプトでいけます。置換元ファイルを絞り込みたい場合は、適宜1行目のfindコマンドを書き換えます。

for i in $(find . -iname "*.js"); do
  git mv "$i" "$(echo $i | rev | cut -d '.' -f 2- | rev).ts";
done

以下を参照。

Git: Rename or move all files at once
https://stackoverflow.com/questions/9151920/git-rename-or-move-all-files-at-once/9151943#9151943

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?