I have previously written on how you can compare the contents of folders to see the differences between them. This is a very useful tip to determine if there is files missing, added files or what files are different. This is especially useful if you want to keep the contents of two folders the same. It is also handy to see if any files have changed between the local copy and a remote copy. This trick uses Terminal, once you get the hang of the command it is very easy to use and very useful.
Comparing Folders Within Terminal
To compare files first open Terminal, located in your Applications > Utilities folder.
Within Terminal locate the folders you want to compare. Use the
cd command to change to the folder that contains the folders you want to compare. You can use /full/path/to/files however locating the folders makes the command easier to write.
Within Terminal write the following:
diff -rq Folder1 Folder2
The diff command will tell you which files are different. The -r option will go through sub folders and see if there are any differences in the subfolders and files. The -q option is very useful in that it will tell you only which files are different. If you omit it, it will tell you how the files are different, i.e give you the lines of text that differ. The -q option is very useful.
The output should look similar to the image below.
The command is telling that .DS_Store and File 1 differ. It also tells me that File 4 is only present in Folder 2. This means that someone has changed File 1 and removed File 4. I can now investigate why this is different.
The diff command is very useful. If you use the
man diff command, you can get more information on the command and its many uses.