JoeH
Jan 20th, 2000, 12:19 AM
I posted a question a week ago about comparing 2 huge lists and getting the difference. One of the suggestions was to use a Collection. It worked and it was 20 times faster than what I had. The problem is that it only finds 8 matches when there are about 10,000 matches. The lists are file name with paths:
c:\autoexec.bat
c:\winnt\calc.exe
...
The matches that it finds are in the root directory ( c:\autoexec.bat , c:\config.sys and so on) Once it hits subfolders it fails to find a match. I did an LCase() on the variable before I add it to the collection. And I did the same to the variable to be compared. So all the data is in lower case. Yet it still can't find all the matches. Here are some snippets from the program:
Public OrjFN As New Collection
.
.
.
Open "c:\OrjNT.txt" For Input As #1
Line Input #1, A$
A$ = LCase$(A$)
OrjFN.Add A$, A$
Close #1
.
.
.
Open "c:\lclfil.txt" For Input As #1
Do
Fnd = 0
Line Input #1, TmpFN
TmpFN = LCase$(TmpFN)
sDummy = OrjFN.Item(TmpFN)
bFound = (Err = 0) 'Err=0 when item found in collection
If bFound Then
Err.Clear
Fnd = 1
End If
If Fnd = 0 Then 'not foud so add it to the list
ServerF.AddItem (TmpFN)
End If
Loop Until EOF(1)
Close #1
I tried to output the contents of the collection to a file, and it was correct.
Am I doing something wrong here?
Is there a limit on the length of the string that can be added to the collection?
------------------
Joe Handal
Workstation Engineer
joe.handal@carle.com
c:\autoexec.bat
c:\winnt\calc.exe
...
The matches that it finds are in the root directory ( c:\autoexec.bat , c:\config.sys and so on) Once it hits subfolders it fails to find a match. I did an LCase() on the variable before I add it to the collection. And I did the same to the variable to be compared. So all the data is in lower case. Yet it still can't find all the matches. Here are some snippets from the program:
Public OrjFN As New Collection
.
.
.
Open "c:\OrjNT.txt" For Input As #1
Line Input #1, A$
A$ = LCase$(A$)
OrjFN.Add A$, A$
Close #1
.
.
.
Open "c:\lclfil.txt" For Input As #1
Do
Fnd = 0
Line Input #1, TmpFN
TmpFN = LCase$(TmpFN)
sDummy = OrjFN.Item(TmpFN)
bFound = (Err = 0) 'Err=0 when item found in collection
If bFound Then
Err.Clear
Fnd = 1
End If
If Fnd = 0 Then 'not foud so add it to the list
ServerF.AddItem (TmpFN)
End If
Loop Until EOF(1)
Close #1
I tried to output the contents of the collection to a file, and it was correct.
Am I doing something wrong here?
Is there a limit on the length of the string that can be added to the collection?
------------------
Joe Handal
Workstation Engineer
joe.handal@carle.com