[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

比较两个目录中的文件 diff -rq的更多相关文章

  1. Python-对比两个目录中Excel文件

    背景:我在5月20日收到了一批Excel文件数据,由于文件很多大约有将近5000个,已经通过编写python脚本处理完成.但是6月9日的时候,又收到了一批新的Excel数据.但是在处理过程中发现,本次 ...

  2. find - 递归地在层次目录中处理文件

    总览 SYNOPSIS find [path...] [expression] 描述 DESCRIPTION 这个文档是GNU版本 find 命令的使用手册. find 搜索目录树上的每一个文件名,它 ...

  3. Linux find命令:在目录中查找文件(超详解)

    find 是 Linux 中强大的搜索命令,不仅可以按照文件名搜索文件,还可以按照权限.大小.时间.inode 号等来搜索文件.但是 find 命令是直接在硬盘中进行搜索的,如果指定的搜索范围过大,f ...

  4. python glob 用通配符查找指定目录中的文件 - 开源中国社区

    python glob 用通配符查找指定目录中的文件 - 开源中国社区 python glob 用通配符查找指定目录中的文件

  5. Linux查看目录中的文件

    Linux查看目录中的文件 youhaidong@youhaidong-ThinkPad-Edge-E545:~$ ls examples.desktop jdk 公共的 视频 文档 音乐 java ...

  6. File类之在指定目录中查找文件

    package IoDemo; import java.io.File; /** * @Title:FileDemo2 * @Description:在指定的目录中查找文件 * @author Cra ...

  7. 使用Parallel计算目录中的文件字节长度

    /// <summary> /// 根据通配符和搜索条件计算给定目录中的文件字节长度 /// </summary> /// <param name="path& ...

  8. linux中/etc与/var目录,各是什么意思?这两个目录下的文件有什么特点?

    http://zhidao.baidu.com/link?url=DkxU9CyhJb_dIUAPCmPmxRtQsENgCzqy5qnLPEj_V9DqNzdt6Qya0U5iCVRCYFkgoRo ...

  9. Python 对目录中的文件进行批量转码(GBK>UTF8)

    通过python实现对文件转码,其实处理很简单: 1.打开读取文件内容到一个字符串变量中,把gbk编码文件,对字符串进行decode转换成unicode 2.然后使用encode转换成utf-8格式. ...

随机推荐

  1. EasyUI datagrid 格式化显示数据

    http://blog.163.com/ppy2790@126/blog/static/103242241201512502532379/ 设置formatter属性,是一个函数,格式化函数有3个参数 ...

  2. 【MVC5】ASP.NET MVC 项目笔记汇总

    ASP.NET MVC 5 + EntityFramework 6 + MySql 先写下列表,之后慢慢补上~ 对MySql数据库使用EntityFramework 使用域用户登录+记住我 画面多按钮 ...

  3. ArrayList与LinkedList区别

    ArrayList 采用的是数组形式来保存对象的,这种方式将对象放在连续的位置中,所以最大的缺点就是插入删除时非常麻烦LinkedList 采用的将对象存放在独立的空间中,而且在每个空间中还保存下一个 ...

  4. C# 获取时间差(几天前,几小时前,几分钟前,几秒前)

    #region 获取时间差string GetTime(BsonString getTime) /// <summary> /// 获取时间差 /// </summary> / ...

  5. Linux 下安装配置 JDK7

    Linux 下安装配置 JDK7 配置环境(debian 7) 自从从Oracle收购Sun近三年来,已经有很多变化.早在8月,甲骨文将“Operating System Distributor Li ...

  6. 新浪微博客户端(32)-设置相册图片的contentMode

    DJStatusPhotoView.m #import "DJStatusPhotoView.h" #import "UIImageView+WebCache.h&quo ...

  7. ZLIB 库

    zlib 编辑 zlib是提供数据压缩用的函式库,由Jean-loup Gailly与Mark Adler所开发,初版0.9版在1995年5月1日发表.zlib使用DEFLATE算法,最初是为libp ...

  8. [转载]如何在Ubuntu上安装LAMP服务器系统

    [2013年7月25日 51CTO外电头条]为何应该在Ubuntu上安装LAMP服务器?从事Web开发工作时,我更偏爱在不受干扰的情况下,在我那台计算机上的开发环境下进行开发.我宁愿所犯的错误大部分是 ...

  9. stripslashes — 反引用一个引用字符串

    stripslashes (PHP 4, PHP 5) stripslashes — 反引用一个引用字符串 Report a bug  说明 string stripslashes ( string  ...

  10. Dean Edwards大神写的addEvent库

    直接晒代码: // written by Dean Edwards, 2005 // with input from Tino Zijdel, Matthias Miller, Diego Perin ...