Skip to content

Instantly share code, notes, and snippets.

@thomasfr
Created September 18, 2014 16:04
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save thomasfr/30f24d1b6201b6b4327d to your computer and use it in GitHub Desktop.
Recursively compare two directories and print which files have changed. Ignore binary files and do not show non existing files in `dir2`
#!/bin/bash
dir1="/tmp/dir1"
dir2="/tmp/dir2"
IFS=$'\n'
for file in $(grep -Ilsr -m 1 '.' "$dir1"); do diff -q --exclude="cache" "$file" "${file/${dir1}/${dir2}}" 2> /dev/null; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment