2
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 5 years have passed since last update.

MS-DOSって地味に使えるという気付き

Posted at

事の起こり

DDLファイルが1テーブルずつ自動生成される現場で、それはまぁいいんだけど、「ローカルに自分で立てたDBにそれを都度反映せよ」というお達しが出た。
ファイル数がバカみたいにある。めんどくさい。

手段を考えてみる

1ファイルずつ実行するのは論外として。
Oracleのsqlplusで@ファイル指定で、ディレクトリ配下のもの全部、って指定が出来るのかもよくわからなかった(また調べとこ・・・)。
上記が出来ないとしても、ファイル1つにすれば済む話やん、WindowsでUnixのcat相当のものってあんのかな。
もしかしてMS-DOSで出来たりしない?

MS-DOSで出来ました

copyコマンドに/bオプションで出来ました。
これでC:¥hoge配下の、拡張子txtのファイルを、all.txtの1ファイルに出力。

> copy /b C:\hoge\*.txt C:\hoge\all.txt

Windows開発あるあるだけれど

今回みたいにファイルをごねごねする=ツール使えば良くね?ってなりがちで、Windowsだとその手のファイルも転がってるんだろうけど、お外(現場ともいう)に出てるとツールをインストールするのにめんどくさいやり取りが発生することが多い。
そもそもやり取りが発生する前に、「やってはいけないこと」だったりするし。
そんなとき、MS-DOSが意外と便利・・・かもしれない。1
また気付きがあり次第追記。

リンク

Windowsのコマンドでファイルを結合する

  1. 調べるのも面倒で、目の前で開発してる言語でツール作り始めるのもあるある。

2
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
2
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?