[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-diffutils] bug#20250: bug#20250: diff by size
From: |
Dave Gordon |
Subject: |
[bug-diffutils] bug#20250: bug#20250: diff by size |
Date: |
Tue, 07 Apr 2015 16:03:01 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 |
On 03/04/15 14:20, Andreas wrote:
> Dear diff-team,
>
> this is not a bug but an idea for a diff option in further versions:
>
> Idea:
> comparison of two files by size only.
>
> why?
> makes comparison extremely fast; often no need to compare file contents
> to get a first hint whether there is a difference at all
>
> example:
> - uploading a folder with a bunch of files to a slow motion cloud;
> comparing each file by contents is very time consuming (...slow motion
> cloud)
> - as a first hint to find out about a possible difference could be the
> comparison of file size for each file uploaded with the local ones
>
> Thanks in advance for integrating this option in future diff versions.
>
> Great tool, great diff team!
> Andreas Schirra
> address@hidden
It probably doesn't belong in diff(1), but maybe in cmp(1)? For example,
it might be a meaningful semantic for the case of "cmp -n 0", which
currently always says "equal" (-n 0 means compare at most 0 bytes), or
some other variation that isn't currently meaningful, such as "cmp -n -1
<FILE1> <FILE2>" ?
OTOH, you can easily get and compare filesizes in a script already,
for example using "stat --printf=%s <FILE>", and for the case of
synchronising with a slow remote backup, rsync(1) already incorporates
lots of clever ways to reduce the bandwidth of the remote traffic,
including using just the filesize and datestamp to check for (mis-)matches.
.Dave.