GNU bug report logs - #20794
ignore subdirectory with diff

Previous Next

Package: diffutils;

Reported by: "杨秉武" <detailyang <at> gmail.com>

Date: Fri, 12 Jun 2015 15:31:02 UTC

Severity: normal

To reply to this bug, email your comments to 20794 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-diffutils <at> gnu.org:
bug#20794; Package diffutils. (Fri, 12 Jun 2015 15:31:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to "杨秉武" <detailyang <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-diffutils <at> gnu.org. (Fri, 12 Jun 2015 15:31:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "杨秉武" <detailyang <at> gmail.com>
To: bug-diffutils <at> gnu.org
Subject: ignore subdirectory with diff
Date: Fri, 12 Jun 2015 01:12:42 -0700 (PDT)
[Message part 1 (text/plain, inline)]
Hi, i want to diff two directory, but ignore subdirectory.
For example:
i want to compare new directory and old directory, but i want to ignore old’s a directory.
when use the command as follow:
diff -Nr --exclude=old/a new old, it will print the difference between old/a and new


But i want to ignore the old/a directory:(
The man page tell me  —exclude means  When comparing directories,  ignore  files  and	subdirectories whose basenames match pattern.



So it means it cannot ignore subdirectory like aa/bb?
Guys tell me how to deal with, pleas:)


├── new
│   ├── a
│   ├── a.txt
│   ├── b
│   └── c
└── old
    ├── a
    │   ├── 1
    │   ├── 2
    │   └── 3
    ├── a.txt
    ├── b
    └── c


—
Sent from Mailbox
[Message part 2 (text/html, inline)]

Information forwarded to bug-diffutils <at> gnu.org:
bug#20794; Package diffutils. (Tue, 03 Jan 2017 05:20:02 GMT) Full text and rfc822 format available.

Message #8 received at 20794 <at> debbugs.gnu.org (full text, mbox):

From: Jeff THUONG <jfthuong <at> gmail.com>
To: 20794 <at> debbugs.gnu.org
Subject: ignore subdirectory with diff
Date: Tue, 3 Jan 2017 12:04:06 +0800
[Message part 1 (text/plain, inline)]
One way to ignore a subdirectory is to use "-x <subdirectory name>"

In the following case, you could use "-x a". Note that would also ignore
files named "a" but not files "a.txt"


├── new
│   ├── a
│   ├── a.txt
│   ├── b
│   └── c
└── old
    ├── a
    │   ├── 1
    │   ├── 2
    │   └── 3
    ├── a.txt
    ├── b
    └── c


In case you want to ignore "aa/bb" (i.e. not comparing "old/aa/bb" and
"new/aa/bb"), you need to use "-x bb" so if you wanted to still
compare "new/cc/bb" and "old/cc/bb" you would be out of luck.
[Message part 2 (text/html, inline)]

This bug report was last modified 8 years and 163 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.