仅计算差异磁盘使用情况

仅计算差异磁盘使用情况

是否有一个简单的命令组合可以计算两个目录结构之间不同的文件的总大小?

diff我正在考虑以某种方式发送to的输出du,但我不够熟练,不知道如何实际执行此操作。

一个例子:

/foo-a/
  bar/
   test1.txt   12 bytes   01/01/2000 12:00:00
   test2.txt   12 bytes   01/01/2000 12:00:00
   test3.txt   12 bytes   01/01/2000 12:00:00
 test4.txt   12 bytes   01/01/2000 12:00:00
 test5.txt   12 bytes   01/01/2000 12:00:00

/foo-b/
  bar/
   test1.txt   12 bytes   01/01/2000 12:00:00
   test2.txt   12 bytes   01/01/2000 12:00:05
   test3.txt   35 bytes   01/01/2000 12:00:05
 test6.txt   12 bytes   01/01/2000 12:00:00
 test7.txt   12 bytes   01/01/2000 12:00:00

在上面,比较两个目录,ba想:

test1.txt: unchanged, same size:      0 bytes
test2.txt: changed, same size:       12 bytes
test3.txt: changed, different size:  35 bytes
test4.txt: unchanged, same size:      0 bytes
test5.txt: deleted:                   0 bytes
test6.txt: hardlink of test4.txt:     0 bytes
test7.txt: added:                    12 bytes

                           total:    59 bytes

相关内容