Kale Worsley


Scripts and snippets
dir-diff(1)
dir-diff(1)
Name
dir-diff - Recursively diff the files listed within two directories. This diffs the files _lists_ not the file content.
Synopsis
  • dir-diff [DIR1] [DIR2]
Description
#/bin/bash

function checkDirExists {
  if [ -e "$1" ] ; then
    if [ ! -d "$1" ] ; then
      echo "dir-diff: $1: No such directory"
      exit 1
    fi
  else
    echo "dir-diff: $1: Not a directory"
    exit 1
  fi
}

if [ ! "$#" -eq 2 ];then
  echo "Usage: dir-diff [DIR1] [DIR2]"
  exit 1
fi

checkDirExists "$1"
checkDirExists "$2"

diff -y <(cd "$1" && ls -1aR) <(cd "$2" && ls -1aR)
Copyright
dir-diff is made available under the MIT License. See MIT LICENSE for details.
2015-09-16 00:00:00 +0000
dir-diff(1)
dir-diff(1)