Directories comparison

Under Un*x like command line environment is nice way, how to compare files in two sub directory trees, current-dir and new-dir, two versions of the same command are shown:

$ cd current-dir
current-dir$ find . -type f -not -exec cmp {} ../new-dir/{} ";" -print
current-dir$ find . -type f ! -exec cmp {} ../new-dir/{} ; -print

find – search for files in a directory hierarchy
cmp – compare two files byte by byte
diff – compare files line by line

This entry was posted in workday. Bookmark the permalink.

Leave a Reply