Tip #480 Diff Two Directories
A quick script to compare files from two directories (for example a backup and working directory).#!/bin/bash cr='*' if [ -z $3 ]; then cr=$3; fi for f in `find $1/$3 -type f | sed "s|$1/||"` do printf "===!%-76s" "$f!" | tr ' !' '= '; echo diff $1/$f $2/$f | sed -e "s/^</$1: /" -e "s/^>/$2: /" done
Usage: [script name] directory1 directory2 to check all files
[script name] directory1 directory2 *html to check files of type html.
alias aptitude at awk bash bc cal cat cd colrm comm cp csh curl cut date dd df dialog diff dirname dpkg du fc find fuser grep gs gzip history iconv kill ksh last less ln ls lsof lynx m4 md5sum mkdir mkfifo mkisofs mv mysql nc netstat openssl OSX perl ping popd ps pushd python read redirection rm scp screen sed sort ssh stat sudo svn tail tar tee test top tr uniq vim wc wget xargs