Comments on: How to Find Difference Between Two Directories Using Diff and Meld Tools https://www.tecmint.com/compare-find-difference-between-two-directories-in-linux/ Tecmint - Linux Howtos, Tutorials, Guides, News, Tips and Tricks. Mon, 20 May 2024 06:20:52 +0000 hourly 1 By: Ravi Saive https://www.tecmint.com/compare-find-difference-between-two-directories-in-linux/comment-page-1/#comment-2172243 Mon, 20 May 2024 06:20:52 +0000 http://www.tecmint.com/?p=25525#comment-2172243 In reply to Bob.

@Bob,

You can limit comparison to file names and sizes by combining find and diff:

find dir1 -type f -exec stat --format='%s %n' {} + | sort > dir1_files.txt
find dir2 -type f -exec stat --format='%s %n' {} + | sort > dir2_files.txt
diff -q dir1_files.txt dir2_files.txt
]]>
By: Bob https://www.tecmint.com/compare-find-difference-between-two-directories-in-linux/comment-page-1/#comment-2171810 Sat, 18 May 2024 07:37:34 +0000 http://www.tecmint.com/?p=25525#comment-2171810 This is not correct; the command `diff -q` is taking excessively long. This is not just comparing two directories; it is comparing the content of all files within the directories.

]]>
By: Jos https://www.tecmint.com/compare-find-difference-between-two-directories-in-linux/comment-page-1/#comment-2129548 Fri, 26 Jan 2024 09:01:01 +0000 http://www.tecmint.com/?p=25525#comment-2129548 In reply to Ravi Saive.

rsync has an extra plus: the directories to be compared do not necessarily have to be on the same system. Comparison can be done between different computers.

]]>
By: Ravi Saive https://www.tecmint.com/compare-find-difference-between-two-directories-in-linux/comment-page-1/#comment-2038743 Wed, 26 Jul 2023 06:26:19 +0000 http://www.tecmint.com/?p=25525#comment-2038743 In reply to Luis Gutiérrez López.

@Luis,

Yes, that’s correct. The rsync --dry-run option allows you to run a trial run of rsync without actually transferring any files. This is a great way to compare two directories and see which files are different.

The syntax for the rsync --dry-run command is as follows:

# rsync --dry-run [options] source_directory destination_directory

For example, to compare the contents of the /home/user/source directory to the /home/user/destination directory, you would use the following command:

# rsync --dry-run /home/user/source /home/user/destination
]]>
By: Luis Gutiérrez López https://www.tecmint.com/compare-find-difference-between-two-directories-in-linux/comment-page-1/#comment-2037471 Mon, 24 Jul 2023 08:47:44 +0000 http://www.tecmint.com/?p=25525#comment-2037471 Helpful!

You can also perform the comparison through rsync using the --dry-run parameter so that it only shows the differences, but without doing anything.

]]>