Link to home
Start Free TrialLog in
Avatar of changchyi
changchyi

asked on

invoke 2 sub function simultaneouly (files comparison)

I have C:\software and D:\software
Now i knew that some files name inside the D:\software is not same
with D:\softare
So i need to do file comparison between C:\softare\*.* and D:\software\*.*

Now i need to invoke 2 function call simultaneouly, 1 function to check
C:\software\ and another to check D:\software\  , then it will detect if any files in D:\
not the same with C:\

I need help on how to invoke 2 sub function simultaneouly !
( i am using 'for each f1 in fso.......next' method to go through the files
1 by 1)
Avatar of Ark
Ark
Flag of Russian Federation image

You can store results in array, collection, listbox etc and compare them after enumeration.
Or during enumeration you can replace first path ("c:\software") with second "d:\software" and check with dir if file exist.

Cheers
Or
Set fld1 = FSO.GetFolder("c:\software")
Set fld2= FSO.GetFolder("d\software")

For i = 1 to fld1.Files.count
    fil1 = fld1.Files.Item(i)
    fil2 = fld2.Files.Item(i)
next i

Cheers
Avatar of chabaud
chabaud

You could also try the WinDiff utility...
ASKER CERTIFIED SOLUTION
Avatar of rspahitz
rspahitz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you want the file lists of two folders simulatiously, you can put two FileListBoxes on a form. Set the path of one FileListBox to one of the folders and the other FileListBox to the other folder. Then you can compare the two lists you get using the List function, something like

If File1.ListCount <>  File1.ListCount Then
   (code for not even the same number of files)
End If

For X = 1 to File1.ListCount
   If File1.List(X)<>File2.List(X) Then
      (code for files not the same here)
   End If
Next X
Comment on my own answer:

   I made a small mistake in typing in the answer. Because the FileListBox control numbers its contents starting from 0, the For statement should read

For X = 0 to File1.ListCount-1

Otherwise, you do not get a comparison on the first file in the list. (Oddly enough, you do not get a crash when trying to read the nonexistant item at the end.) Sorry about the mistake.


 
well if u want to use both the functions at the same time...then u would have to use multithreading.. which i dont know how it is done explicilty tru vb... but i certainly know how to do it using api calls in combination with the addressof operator...
this allows both the functions to run at the same time on independent threads

i hope this helps u..need more info.....i am listening...



Metallika Rulz!!
Rejecting proposed answer.

Experts, please provide feedback on which comment should be graded here.

costello
Community Support Moderator @ Experts-Exchange
I would probably go with Ark's 2nd comment, or my 1st comment.
Hi changchyi,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will suggest to:

    Accept rspahitz's comment(s) as an answer.

changchyi, if you think your question was not answered at all or if you need help, you can simply post a new comment here.  Community Support moderators will follow up.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
Comment from expert accepted as answer

Computer101
E-E Moderator