how to compare permissions between two dirs
Ian Smith
smithi at nimnet.asn.au
Tue Mar 23 07:41:08 UTC 2010
In freebsd-questions Digest, Vol 303, Issue 2, Message: 11
On Mon, 22 Mar 2010 07:33:28 -0400 "Aryeh M. Friedman" <aryeh.friedman at gmail.com>
> In switching to a new make file for a personal project I have run into
> the problem of under the old makefile everything works (web site) and
> under the new one it does not... when manually looking at the two dirs
> they appear identical in layout, sizes and perms (dir and file level)
> but I want to make sure... is there any way to compare two diff dirs and
> see if they only differ in date stamps? (note since there are several
> developers working on this project I need to compare even if the owners
> are diff)
% diff dir1 dir2
should do what you need, to compare file existence and contents.
% ls -lrt bittorrent bittorrent2
bittorrent2:
total 82
-rw-r----- 1 smithi smithi 81110 Nov 22 2004 bittorrentecon.pdf
-rw-r----- 1 smithi smithi 0 Jun 9 2006 not_in_1
-rw-r----- 1 smithi smithi 49 Jun 9 2006 differingfile
bittorrent:
total 82
-rw-r----- 1 smithi smithi 81110 Nov 22 2004 bittorrentecon.pdf
-rw-r----- 1 smithi smithi 0 Jun 9 2006 not_in_2
-rw-r----- 1 smithi smithi 28 Jun 9 2006 differingfile
% diff bittorrent bittorrent2
diff bittorrent/differingfile bittorrent2/differingfile
1,2c1,3
< this one in bittorrent dir
<
---
> this one in bittorrent2 dir
> with an extra line
>
Only in bittorrent2: not_in_1
Only in bittorrent: not_in_2
Then to just compare (eg) permissions and names, something like:
ls -la dir1 | awk '{print $1,$9}' >/tmp/lsd1
ls -la dir2 | awk '{print $1,$9}' >/tmp/lsd2
diff /tmp/lsd1 /tmp/lsd2
cheers, Ian
More information about the freebsd-questions
mailing list