LoginSignup
0
0

More than 1 year has passed since last update.

renameコマンド使ってみた

Posted at

renameコマンドで個人的に使った条件を備忘録的に置いておきます。(随時更新するかも)

install

brew install rename

使ったケース

ディレクトリ内のファイルの名前を特定の名前blogpost.mdに一括でリネームしたい

.
├── A
│   └── aaa
│       └── aaa.md
├── B
│   └── bbb
│       └── bbb.md

.
├── A
│   └── aaa
│       └── blogpost.md
├── B
│   └── bbb
│       └── blogpost.md

にしたい

答え

rename 's/(.+)\/(.+)(\.md+$)/$1\/blogpost.md/' ./**/*.md

$1がディレクトリ名部分、$2が変える前のファイル名、$3が拡張子になる

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