You are not logged in.
I'm interested in using diff specifically to verify data integrity; that is, to make sure each file in dirA is data-identical to the corresponding file in dirB. I'm pretty sure it does that, I just want to verify it's not 'assuming identical' if size and timestamps are the same. Thanks.
Last edited by alphaniner (2014-04-09 13:17:16)
But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner
Offline
A short test indicates that diff -r should do what you want.
div curl F = 0
Offline
The '-r' is definitely necessary, I use diff -rq <dir> <dir> . I want to confirm file contents are actually compared if they appear to be identical.
But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner
Offline
Testing with 'touch' suggests it does what you want:
% cat foo/foo
hello
% cat bar/foo
hell0
% touch -t 201301011234.20 foo/foo
% touch -t 201301011234.20 bar/foo
% diff -qr foo bar
Files foo/foo and bar/foo differ
Offline
Wait, no, that wasn't a sufficient test. Again with only one invocation of 'touch' so the change times are the same:
% touch -amt 201301011234.20 foo/foo bar/foo
% stat bar/foo foo/foo
File: 'bar/foo'
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: fe01h/65025d Inode: 341815 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ trent) Gid: ( 100/ users)
Access: 2013-01-01 12:34:20.000000000 -0500
Modify: 2013-01-01 12:34:20.000000000 -0500
Change: 2014-04-09 08:18:44.000000000 -0400
Birth: -
File: 'foo/foo'
Size: 6 Blocks: 8 IO Block: 4096 regular file
Device: fe01h/65025d Inode: 341873 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ trent) Gid: ( 100/ users)
Access: 2013-01-01 12:34:20.000000000 -0500
Modify: 2013-01-01 12:34:20.000000000 -0500
Change: 2014-04-09 08:18:44.000000000 -0400
Birth: -
% diff -qr foo bar
Files foo/foo and bar/foo differ
Last edited by Trent (2014-04-09 12:16:40)
Offline
I did the first 'touch test' too, and I *think* it is actually sufficient. But as you pointed out the ctimes are different so I wasn't sure. I couldn't figure out how to make them identical, so thanks.
For the record, everything seems to indicate diff does what I want, but it wasn't explicit. And it was [or seemed] so much faster than verifying dirB with a md5 checksum hash of dirA, it didn't seem like it could actually be reading the files.
But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner
Offline
If two file names are given and both are directories, `diff'
compares corresponding files in both directories, in alphabetical
order; this comparison is not recursive unless the `--recursive' (`-r')
option is given. `diff' never compares the actual contents of a
directory as if it were a file. The file that is fully specified may
not be standard input, because standard input is nameless and the
notion of "file with the same name" does not apply.
Offline