Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.misc > #13185
| From | Rich <rich@example.invalid> |
|---|---|
| Newsgroups | comp.os.linux.misc |
| Subject | Re: Compare 2 dir-TREES? |
| Date | 2015-01-02 21:39 +0000 |
| Organization | My Linux Box |
| Message-ID | <m87379$uri$2@dont-email.me> (permalink) |
| References | <pan.2015.01.01.02.56.21@gmail.com> <nHHB4I.9Ft@yahoo.com> |
Jack Strangio <jackstrangio@yahoo.com> wrote: > Unknown <dog@gmail.com> writes: > > I can't find how to do this common task! > > `du | wc -l` will show the NUMBER of files - I think? > > > > -> rsync --list-only /mnt/p15/usr/X11R6/DumyDirTstRsync > > /usr/X11R6/DumyDirTstRsync > > == drwxr-xr-x 4096 2014/12/31 18:46:24 DumyDirTstRsync > > == ! does NOT tell WHAT differences !! > > > > So: `rsync --list-only <Tree1> <Tree2>` <-- FAILS !! > > > > What am I doing wrong, for this simple/common task? > There are several ways. I use this quick n dirty but effective method: > to compare directory trees A and B - > cd /A > find . -type f | sort > /tmp/Afiles > cd /B > find . -type f | sort > /tmp/Bfiles > then to find the extra A files > diff /tmp/Afiles /tmp/Bfiles | grep '< ' > /tmp/Aextras > and to find the extra B files > diff /tmp/Afiles /tmp/Bfiles | grep '> ' > /tmp/Bextras If your "Afiles" and "Bfiles" inputs are in sorted order, then the "comm" utility can replace both of the diff calls above. You'll get an output showing what only exists in A, what exists in both, and what only exists in B. man comm for the man page or info coreutils 'comm invocation' if you want to read the "info" documentation.
Back to comp.os.linux.misc | Previous | Next — Previous in thread | Find similar | Unroll thread
Compare 2 dir-TREES? Unknown <dog@gmail.com> - 2015-01-01 02:49 +0000
Re: Compare 2 dir-TREES? Robert Heller <heller@deepsoft.com> - 2014-12-31 21:25 -0600
Re: Compare 2 dir-TREES? Jack Strangio <jackstrangio@yahoo.com> - 2015-01-01 03:31 +0000
Re: Compare 2 dir-TREES? Rich <rich@example.invalid> - 2015-01-02 21:39 +0000
csiph-web