LoginSignup
0
0

More than 3 years have passed since last update.

nodejsでgit mvのループ処理

Posted at

_付いてない.scssをgit mvで_付けてリネームする必要があって、コマンドを調べてたんですが、macOSだとfindに-print引数が無かったりして積みました。
代わりにnodejsのコンソールで似たようなコマンドを実装することに。

node
node
// カレントディレクトにある_付いてない全てのscssを_付けてリネーム
require('fs').readdirSync('.').filter(file => file.match(/^(?!_).*?\.scss$/)).forEach(scss => require('child_process').execSync(`git mv ${scss} _${scss}`, { stdio: 'inherit' }))
// git mv hoge.scss _hoge.scss
// git mv fuga.scss _fuga.scss
// git mv piyo.scss _piyo.scss

jsしか読めないのつらい

0
0
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
0