Kudithipudi.Org

September 11, 2012

HOW TO : Compare two directories in Linux

Filed under: HOWTO,Linux — Vinay @ 10:26 am

Quick post on using diff to compare two directories in Linux. This will show the list of files and subdirectories that are different in either directories

diff /PATH_TO_FIRST_DIRECTORY /PATH_TO_SECOND_DIRECTORY -r --brief  

Options used

  • r : Searched recursively through the directory
  • –brief : Only shows the names of the files that differ. If you want details of the content that differs, remove this option

2 Comments »

  1. I works fine with small directories.

    Few months back I wanted to checked the difference between 2 Huge directories. I executed this ‘diff’ command (without –brief option), it ran for few hours but never finished. I may have to check with this –brief option :)

    Thanks
    Ashok

    Comment by Ashok — September 20, 2012 @ 12:38 am

  2. I would imagine it would slow down for large directories. May have to write a simple perl/python script to do a md5 checksum and report on the differences.

    Comment by Vinay — September 21, 2012 @ 7:39 am

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress