file1=InputBox("enter the path","","E:\test.txt")
file2=InputBox("enter the path","","E:\textcheck.txt")
Function comparefiles(file1,file2)
Set fso=createobject("scripting.filesystemobject")
if (fso.getfile(file1).size)<>(fso.getfile(file2).size) then
comparefiles=true
Exit function
end if
Set d=fso.getfile(file1).openastextstream(1,0)
Set s=fso.getfile(file2).openastextstream(1,0)
comparefiles=false
Do while d.atendofstream=false
file1content=d.readline
file2content=s.readline
comparefiles=strcomp(file1content,file2content,1)
If (comparefiles<>0) Then
comparefiles=true
Exit do
End If
Loop
d.close
s.close
End Function
If comparefiles(file1,file2)=false Then
MsgBox("identical")
else
msgbox("not identical")
End If
No comments:
Post a Comment