You can also go a step further and redirect the output of that command to a file, let’s say it’s named differences.txt:ĭiff -rq directory1 directory2 > differences.txt Only in directory2: MyFavoriteSpecialMovie.mp4 Only in directory1: SuperSecretDifferentFile.rtf Sample output of the command may look like the following: We are using the -rq flag because -r means it is recursive to include subdirectories, and -q simplifies the command output to only the differences shown. This executes the diff command comparing directory1 and directory2 (if you have a folder with a space in the file name, just put it in quotes like so: “folder one”). Hit return when you have specified the appropriate directories to compare. To get started, launch the Terminal in Mac OS (found in /Applications/Utilities/) and then use the following command syntax: How to Compare Contents of Two Directories with diff Diff is quite simple to use for easily comparing the contents of any two directories, just follow along by using syntax detailed below. To achieve this comparison, we’ll use the command line tool ‘diff’, diff is available on all Macs, along with linux and other unix operating systems, so this is effectively a cross-platform solution for comparing directories.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
June 2023
Categories |