LoginSignup
10
11

More than 5 years have passed since last update.

Terminalを使ってファイル名を一括置換する方法

Posted at

36歳にして重度の花粉症になったかと思いきや、花粉さんとのつきあい方にすでに順応しているアトラエデザイナーの紺谷です。

さて、assetsの中にある .css ファイルをすべて .scss に変更するというかなり地味目の作業を後輩の橋川くんから依頼され、terminalとかでできるんだろうな、と思って調べてみた次第です。

まずは assetsstylesheets に移動。

cd app/assets/stylesheets/

以下のコマンドを打つと、サブディレクトリの中のファイルまで全部置換してくれる。

find . -name "*.css" | while read file; do mv $file ${file/.css/.scss}; done
10
11
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
10
11