Comparer deux fichiers dans leur intégralités
Bonjour,
Je cherche a comparer deux fichiers textes et sortir les differences entre le Fichier 2 et le fichier 1 dans un troisieme fichier texte. Voici mon code actuel
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile1 = objFSO.OpenTextFile("D:\VBS\Comparetxtfile\file1.log", ForReading)
strCurrentDevices = objFile1.ReadAll
objFile1.Close
Set objFile2 = objFSO.OpenTextFile("D:\VBS\Comparetxtfile\file2.log", ForReading)
Do Until objFile2.AtEndOfStream
strAddress = objFile2.ReadLine
If InStr(strCurrentDevices, strAddress) = 0 Then
strNotCurrent = strNotCurrent & strAddress & vbCrLf
End If
Loop
objFile2.Close
'Wscript.Echo "Addresses without current devices: " & vbCrLf & strNotCurrent
Set objFile3 = objFSO.CreateTextFile("D:\VBS\Comparetxtfile\result.log")
objFile3.WriteLine strNotCurrent
objFile3.Close |
Je cherche a comparer les fichiers entiers par exemple si le fichier 1 contient :
banane
Abricot
Pomme
Et le fichier 2
Banane
Abricot
Pomme
Banane
Le fichier 3 devra resortir banane meme si celui ci est présent dans le fichier 1..