Created
March 4, 2016 19:22
-
-
Save gnanet/91f86f52660287a0b754 to your computer and use it in GitHub Desktop.
diff nonbinary oneliner recursive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # diff two folders located in the same parent-folder | |
| # look for binary files in both, exclude txt|css|tpl|php if they contain binary stings (like foreign language) | |
| oldpath=old/ | |
| newpath=new/ | |
| if [ ! -d ${oldpath} ]; then echo "${oldpath} is not a folder"; exit ; fi | |
| if [ ! -d ${newpath} ]; then echo "${newpath} is not a folder"; exit ; fi | |
| # | |
| # If you use this as a oneliner replace ${oldpath} and ${newpath} with the folder names | |
| # | |
| excludes=`grep -ILsr -m 1 '.' ./ | sed -e "s/^.*\.//g" | sort | uniq | egrep -v "txt|css|tpl|php" | awk {' printf "-x *."$1" " '}; echo` ; diff -Naur -iEwB ${excludes} ${oldpath} ${newpath} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment