compare two folders
Find which files differ between two folders, or are only in one of them.
Steps
-
diff -rq dir1 dir2the files that differ, and those only in one
-
diff -r dir1 dir2the same, with the lines that differ
-
diff -u old.txt new.txttwo files, the changed lines in context
-
rsync -rcn --out-format='%n' dir1/ dir2/what a copy from dir1 would change in dir2, by content
Notes
- meld, if installed, shows the same side by side.
Commands used
diffrsynccmp
Each has a page in lore: lore diff opens it.
Related recipes
- count lines, words and filesCount the lines of a file or of a command's output, the words, and the files in a folder.
- delete lines containing a textRemove every line of a file that contains a word, or keep only those lines.
- find files containing a textSearch every file under a folder for a word or a phrase, and show where it is.
- replace text in a fileChange every place a word or a phrase appears in a file, keeping a copy if you like.