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 > wiis...@web.de
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.