Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.misc > #13149 > unrolled thread
| Started by | Unknown <dog@gmail.com> |
|---|---|
| First post | 2015-01-01 02:49 +0000 |
| Last post | 2015-01-02 21:39 +0000 |
| Articles | 4 — 4 participants |
Back to article view | Back to comp.os.linux.misc
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
| From | Unknown <dog@gmail.com> |
|---|---|
| Date | 2015-01-01 02:49 +0000 |
| Subject | Compare 2 dir-TREES? |
| Message-ID | <pan.2015.01.01.02.56.21@gmail.com> |
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?
[toc] | [next] | [standalone]
| From | Robert Heller <heller@deepsoft.com> |
|---|---|
| Date | 2014-12-31 21:25 -0600 |
| Message-ID | <XMydnVnjg6uSIznJnZ2dnUU7-TmdnZ2d@giganews.com> |
| In reply to | #13149 |
At Thu, 1 Jan 2015 02:49:08 +0000 (UTC) Unknown <dog@gmail.com> wrote:
>
> I can't find how to do this common task!
> `du | wc -l` will show the NUMBER of files - I think?
No.
find -type f|wc -l
will show the number of regular files
>
> -> 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?
diff -r --brief /mnt/p15/usr/X11R6/DumyDirTstRsync /usr/X11R6/DumyDirTstRsync
('man diff' will list all of the options)
>
--
Robert Heller -- 978-544-6933
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
heller@deepsoft.com -- Webhosting Services
[toc] | [prev] | [next] | [standalone]
| From | Jack Strangio <jackstrangio@yahoo.com> |
|---|---|
| Date | 2015-01-01 03:31 +0000 |
| Message-ID | <nHHB4I.9Ft@yahoo.com> |
| In reply to | #13149 |
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
Jack
--
"I'm a home-loving girl. And that's where I wish I was."
"At home ..."
"Loving."
- Laugh-In, 1968
[toc] | [prev] | [next] | [standalone]
| From | Rich <rich@example.invalid> |
|---|---|
| Date | 2015-01-02 21:39 +0000 |
| Message-ID | <m87379$uri$2@dont-email.me> |
| In reply to | #13153 |
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.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.os.linux.misc
csiph-web