Skip to content

Instantly share code, notes, and snippets.

@even4void
Created September 13, 2024 17:32
Show Gist options
  • Save even4void/8d6e96ea2d45c09935be28ea94703ad1 to your computer and use it in GitHub Desktop.
Save even4void/8d6e96ea2d45c09935be28ea94703ad1 to your computer and use it in GitHub Desktop.
Diff for directories
#!/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")
@even4void
Copy link
Author

Old stuff. Better to use difftastic now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment