Compare files in two folders

Comparing two files is easy on linux and this can be really useful. In my case, I frequently receive folders on my share folder that I make a copy of and work on. Sometimes I forget if I ever made a copy of it and worked on it. If the folder that looks to be a copy is really a copy of that folder or something else. Diff comes to the rescue.

diff -r path/to/dir1 path/to/dir2

This gives me a list that tells me if these files have been changed. Diff looks at these files as binary files so it is not looking at the semantics of the files. If it finds a change, any sort of change, it will report it to you. You can look into it and see if there is something wrong.

Binary files /home/data/text1.docx and data/text1.docx differ

This basically tells me that there is a difference in these two files. Depending on how many files you have, you would probably get many more.

You would also get something like these if there files only in one of the two folders
Only in /home/data: 01.wav


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s