Created
September 13, 2024 17:32
-
-
Save even4void/8d6e96ea2d45c09935be28ea94703ad1 to your computer and use it in GitHub Desktop.
Diff for directories
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/zsh | |
dir1="$1" | |
dir2="$2" | |
if [ ! -d "$dir1" ]; then | |
echo "Directory $dir1 does not exist." | |
exit 2 | |
fi | |
if [ ! -d "$dir2" ]; then | |
echo "Directory $dir2 does not exist." | |
exit 2 | |
fi | |
listfiles () { | |
(cd "$1"; find . -type f) | sort -f | |
} | |
diff -u <(listfiles "$dir1") <(listfiles "$dir2") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Old stuff. Better to use difftastic now.