Need to Compare Two Text Files

Hello All,

I have 2 different folders and both folders I have text format files. I need to compare both text files are same or not.

If my files are not same I need to get the value which contents are different in my files.

Could you please anyone help with this scenario? It’s a little urgent task.

Thanks in Advance.

Hi @yogavalli,

can you please give me some example files and output file, so that we can understand in better way.


Thank you for your immediate response @arivu96,

Can you please check the attached example files.Ex_2.txt (2.5 KB) Ex_1.txt (2.2 KB)

Hi @yogavalli,

Sorry for late response

I gone through the text file. Can you share the output file to how you are expecting.

Use read text file to read both text file

Use for each activity to loop the strText1 variable like below

If condition strText1.contains(item)
If no add it in separate variable.(strdiff)

So you can get the different


you could start by checking their sizes, that is faster, and then only when not you compare the text inside…

Interesting idea. How do you do that? Suggestions?


Hi, welcome to the community!
You can check the file size like this:

Dim myFile As New FileInfo("file.txt")
Dim sizeInBytes As Long = myFile.Length