{"id":1241,"date":"2012-08-24T08:58:31","date_gmt":"2012-08-24T08:58:31","guid":{"rendered":"http:\/\/blog.designed79.co.uk\/?p=1241"},"modified":"2012-08-24T08:59:30","modified_gmt":"2012-08-24T08:59:30","slug":"compare-folders-or-volumes-for-differences-using-diff","status":"publish","type":"post","link":"https:\/\/blog.designed79.co.uk\/?p=1241","title":{"rendered":"Compare Folders or Volumes for differences using DIFF"},"content":{"rendered":"<p>Have you ever wanted a quick way to compare two directories (folders), in order to see which files may differ between the two? You can use FileMerge\u00a0(part of Apple\u2019s Xcode developer tools), which can do just that. There are other third-party GUI tools as well, but there\u2019s actually a free folder comparison tool built into every Mac\u2014it just requires a quick trip to Terminal to put it to use. The program is called\u00a0<tt>diff<\/tt>, and it\u2019s quite simple to use.<\/p>\n<p>Launch Terminal (in Applications -&gt; Utilities), and then use the cd command to change to the directory containing the folders you\u2019d like to compare. (The folders can be located anywhere, of course, but it\u2019s easiest if they\u2019re in the same folder.). Once there, just run this command:<\/p>\n<pre>\n\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"text codecolorer\">diff -rq folder1 folder2<\/div><\/div>\n\n<\/pre>\n<p>This is a pretty simple command, with two command-line switches (<tt>-rq<\/tt>). The\u00a0<tt>r<\/tt>\u00a0tells\u00a0<tt>diff<\/tt>\u00a0to look at each directory recursively, including subdirectories. The\u00a0<tt>q<\/tt>\u00a0switch sets\u00a0<tt>diff<\/tt>\u00a0brief mode. If we didn\u2019t set brief mode,\u00a0<tt>diff<\/tt>\u00a0would not only tell you which files are different between the two folders, but also show the actual line-by-line differences for any text files that exist in both locations but are not identical. Given that we\u2019re just interested in comparing the folders\u2019 contents, we don\u2019t need that level of detail, so we\u2019ll use brief mode to suppress it. And that\u2019s all there is to it.<\/p>\n<p>Obviously, this is a simplistic example, but it works just as well on a large folder with hundreds of files. If you want to do more with\u00a0<tt>diff<\/tt>, of course, it\u2019s capable of much more than just simple folder comparisons; type\u00a0<tt>man diff<\/tt>\u00a0to read about its full capabilities.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Have you ever wanted a quick way to compare two directories (folders), in order to see which files may differ between the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1241","post","type-post","status-publish","format-standard","hentry","category-info-on-tech"],"_links":{"self":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1241","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1241"}],"version-history":[{"count":0,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/1241\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1241"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1241"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.designed79.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}