zoukankan      html  css  js  c++  java
  • 比较两个目录中的文件 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
    
  • 相关阅读:
    判断UpLoader是否安装了Flash
    事务
    AMQP
    分布式领域CAP理论
    查看数据库所有表的所有字段
    拼分页方法
    Website English Comments
    SQL语句执行时间测试
    一般处理程序返回json
    MVC Action返回Json
  • 原文地址:https://www.cnblogs.com/bass6/p/5555591.html
Copyright © 2011-2022 走看看