Benches macOS

7

diff terminal command

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

I want to compare two folders using the diff command in Terminal.

One is on an external drive called “Seagate_181110_8TB_Drive”, and the folder is called “verified_saved_on_190109_HDD”.

The other is on a different external drive called “190109_HDD⁩” and the folder is called “verified_from_Seagate_181110_8TB_Drive”.

What is the correct syntax for that command?

7 replies

Sign in or join Beachball Help to reply.

  1. 0

    leroydouglas

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    The -w flag can be handy for plain text files because it tells diff to ignore white space when comparing files. And of course you can use a full path to the files to compare.

    diff (file input 1) (file input 2)
    

    You can see more from the terminal, copy and paste:

    man diff | more
    

    Using the -rq flag because -r means it is recursive to include subdirectories, and -q simplifies the command output to only the differences shown.

  2. 0

    Mr. Spock

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Hi leroydouglas,

    Thank you for that. I have tried that but no joy.

    $ diff verified_saved_on_190109_HDD verified_from_Seagate_181110_8TB_Drive

    diff: verified_saved_on_190109_HDD: No such file or directory

    diff: verified_from_Seagate_181110_8TB_Drive: No such file or directory

    I think it is because they are on external volumes. How do I set the command for the different volumes?

  3. 0

    leroydouglas

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Show the mounted drives on the desktop.

    From here you can drag the drive to the terminal—This will automatically place the path to the drive, then complete the path/with the specific file or folder you are comparing.

    blank spaces need to be escaped( ) , dragging and dropping the drive will do it for you

    ex.

     /Volumes/Install macOS Mojave 

  4. 0

    Mr. Spock

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    OK, no errors so far and the folders are 1.3 TB each (give or take a few MB) so this will take some time I am sure. I'll report back if it fails. So far, I am thinking no news is good news.

    I entered this: diff -rq /Volumes/190109_HDD/181110_8TB_Drive_contents_2/verified_from_Seagate_181110_8TB_Drive /Volumes/Seagate_181110_8TB_Drive/verified_saved_on_190109_HDD

    and got this (so far): Only in /Volumes/190109_HDD/181110_8TB_Drive_contents_2/verified_from_Seagate_181110_8TB_Drive: .DS_Store

  5. 0

    Mr. Spock

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    It just found my first difference so it is definitely doing what it is meant to. Thank you @leroydouglas.

  6. 0

    leroydouglas

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    It just found my first difference so it is definitely doing what it is meant to.

    Good computing Mr. Spock !

  7. 0

    Tony T1

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    I see you have your answer, but for a GUI method, see: http://kdiff3.sourceforge.net