File and Folder comparison tools
Folder comparison
diff command line tool
Using double quotes on the folder names lets us use folder names with whitespaces in them.
diff -rq "directory1/" "directory2/"
diff -r directory1/ directory2/ > differeces.txt
Flag | Description |
---|---|
-r |
indicates recurse through subdirectories |
-q |
gives brief output (i.e. don’t show the actual diffs, just note what files/dirs are different) |
-s |
report identical files |
-i |
ignore case in file contents |
--ignore-file-name-case |
ignore case when comparing file names |
If you want to avoid warnings (mostly usefulness warnings) about differences in the .DS_Store files, then use:
diff -r directory1/ directory2/ | grep -v .DS_Store
You can exclude subfolders directly by diff --exclude node_modules
VSCode
If you are using Visual Studio Code, you can use the Compare Folders extension on the marketplace.
https://marketplace.visualstudio.com/items?itemName=moshfeu.compare-folders
You open up a folder/project in Visual Studio Code, then select the two folders for compare. Right click and choose the new extension menu item.
It will bring up a new tab where it has differences in common files, a list of the files that are only in the first folder, and a list of files that are only in the second folder. It will use the built-in diff tool from Visual Studio Code.
meld - A file and folder comparison tool
- Works great in Linux
- Doesn’t seem to be available in homebrew (for macos) though
diffmerge
-
Available in homebrew for macos https://formulae.brew.sh/cask/diffmerge#default
But macosx wouldn’t open it because it cannot check if the software is free from malware. So it is not very helpful.
File comparison
- IntelliJ works best. It supports two-way moving of lines
- VS Code is good for viewing the differences - but not great for merging differences - it only supports one-way moving.
- emacs - comparing files
- vim - file comparison
- meld - A file and folder comparison tool
- Works great in Linux
- Doesn’t seem to be available in homebrew (for macos) though