Linux – how to check whether two directories differ (no file list)

bash-scriptingcommand linelinux

I'd like to get binary information whether two directories differ or not.
I don't want to list different files. Just binary result that can be used in "if" statement. How to do this?

Best Answer

  • I would try

     if diff -q DIR1 DIR2 
    

    If that is still too verbose

    if diff -q DIR1 DIR2 > /dev/null