Package: diffutils Version: 1:3.10-4 Severity: wishlist
$ mkdir a b $ echo "a" > a/f1 $ echo "b" > b/f1 $ echo "b" > b/f2 $ echo "a" > a/f2 $ touch a/f3 $ touch b/f3 $ diff -rq a b Files a/f1 and b/f1 differ Files a/f2 and b/f2 differ In each line, diff prints the files from directory a before the files from directory b. I wish for an option, say, --print-newest-first, such that the newest (with respect to the modification time) file in each pair of differing files is printed first: $ diff -rq --print-newest-first a b Files a/f1 and b/f1 differ; the first file has a newer modification time. Files b/f2 and a/f2 differ; the first file has a newer modification time. The advantage of this option would be an easier synchronization of the directories. This would allow the user to copy "a/f1 and b/f1" into the exchange buffer with a mouse, paste it into the command line, delete “and ”, and issue commands, e.g., $ cwdiff a/f1 b/f1 $ cp -auv a/f1 b/f1 $ cwdiff b/f2 a/f2 $ cp -auv b/f2 a/f2 for which the order of arguments, and I mean for cp here, is important. (On my systen, cwdiff performs a colored wdiff; other typical commands in its place are colordiff, diffuse, xxdiff, diff <(exiftool …) <(exiftool …), diffpdf, … – it's a user's choice.) As of now, syncing is more tedious: the user has to check which file is newer with $ ls -l a/f1 b/f1 $ ls -l a/f2 b/f2 and then exchange the order of the arguments in case he or she decides to simply copy the newer file to the older; the exchange involves much more work with keyboard and mouse. You may ask what should happen if the modification times are equal. In this case, I suggest that the creation/birth times be compared (if present), and should they be equal (or at least one of them be absent), the access times (if present); of course, the wording of “the first file has a newer modification time” has to be adapted accordingly in such cases.

