38
28

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.

linux > 複数ファイルのdiffを取る > diff -r フォルダ1 フォルダ2

Last updated at Posted at 2015-02-05

ある2つのフォルダにある複数のファイルのdiffを取りたい。

ファイルごとにdiffを取るのが面倒くさい時、以下を実行する。

$ diff -r . work1

上記の例では、カレントフォルダ(.)とその下にあるwork1のフォルダ内のファイルのdiffを取る。

実行結果例は

Only_in .: Makefile
diff -r ./main.c work1/main.c
124c124
< #include "sd2.h"
---
> #inlcude "sd.h"
Only in .: sub_init.c
Only in .: sub_init.h

のようになる。

Only inというのは、そのフォルダにのみあり、もう片方にはないファイル (Makefile, sub_init.c, sub_init.h)。

diff -r ./main.c work1/main.cから> #include "sd.h"までがmain.cのdiffを表す。

38
28
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
38
28

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?