比较两个目录中的文件 diff -rq
[root@bass test]# mkdir A B [root@bass test]# tree A A └── lin 0 directories, 1 file [root@bass test]# tree B B └── lin 0 directories, 1 file [root@bass test]# echo "hello A" > A/lin [root@bass test]# echo "hello B" > B/lin [root@bass test]# diff -rq A B Files A/lin and B/lin differ [root@bass test]# echo "hello A" > B/lin [root@bass test]# diff -rq A B [root@bass test]#
[root@bass test]# mkdir A/a [root@bass test]# mkdir B/b [root@bass test]# diff -rql A B Only in A: a Only in B: b Files A/lin and B/lin differ [root@bass test]# diff -rql A B Only in A: a Only in B: b Files A/lin and B/lin differ [root@bass test]# ls A B [root@bass test]# mv A/a/ A/x [root@bass test]# tree A A ├── lin └── x 1 directory, 1 file [root@bass test]# mv B/b B/x [root@bass test]# tree B B ├── lin └── x 1 directory, 1 file [root@bass test]# diff -rq A B Files A/lin and B/lin differ [root@bass test]# cat A/lin hello A [root@bass test]# cat B/lin hello B
[root@bass test]# touch A/x/chen [root@bass test]# touch B/x/chen [root@bass test]# diff -rq A B Files A/lin and B/lin differ [root@bass test]# echo "hello chen" > A/x/chen [root@bass test]# echo "hello chen" > B/x/lin [root@bass test]# diff -rq A B Files A/lin and B/lin differ Files A/x/chen and B/x/chen differ Only in B/x: lin
联系方式QQ:326528263 EMAIL:clnking@163.com 网名:bass 分享技术 突破难点 创新思维