Solved

hard drive search

Posted on 1998-07-13
9
143 Views
Last Modified: 2010-05-03
I am trying to write a program that will search every directory on person's hard drive (C:) for a number of files.  I was wondering if someone could either tell me where on the Internet to find the code or, if someone has the code handy and would be willing to give it to me, I would greatly appreciate it.
0
Comment
Question by:tdiamond
9 Comments
 
LVL 1

Expert Comment

by:redbaron082997
ID: 1465620
I think I have the solution. Give me a few moments and I will be back with the solution.
0
 
LVL 7

Expert Comment

by:kamall
ID: 1465621
redbaron: Please DO NOT lock the question without providing an answer!!!

tdiamond, here is the code:

   Option Explicit

        Dim colFiles As Collection

        Private Sub Command1_Click()
            Dim vIte As Variant
             
            Set colFiles = New Collection
            MyFindFiles "C:\", Text1.Text
            For Each vIte In colFiles
                MsgBox vIte
            Next vIte
            Set colFiles = Nothing
             
        End Sub

        Private Sub MyFindFiles(ByVal sPath As String, ByVal sFilePattern As String)
            Dim sFile As String
            Dim vIte As Variant
            Dim colDir As New Collection
             
            On Error Resume Next
             
            sFile = Dir$(sPath & sFilePattern)
            While sFile <> ""
                If Left$(sFile, 1) <> "." Then
                    colFiles.Add sPath & sFile
                End If
                sFile = Dir$
            Wend
                 
            sFile = Dir$(sPath, vbDirectory)
            While sFile <> ""
                If Left$(sFile, 1) <> "." Then
                    If GetAttr(sPath & sFile) And vbDirectory Then
                        colDir.Add sPath & sFile & "\"
                    End If
                End If
                sFile = Dir$
            Wend
             
            For Each vIte In colDir
                MyFindFiles vIte, sFilePattern
            Next vIte
             
            Set colDir = Nothing
        End Sub

0
 
LVL 7

Expert Comment

by:kamall
ID: 1465622
tdiamond, give me your e-mail address to get the complete project.
0
 
LVL 7

Expert Comment

by:kamall
ID: 1465623
tdiamond, please reject the proposed answer so I can lock the question and send you the project.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Expert Comment

by:redbaron082997
ID: 1465624
KAMALL: YOU MUST HAVE WOKEN UP ON THE WRONG SIDE OF THE BED. IT IS COMMON PRACTICE TO LOCK A QUESTION IN ORDER TO PREPARE AN ANSWER THAT I HAD. UNFORTUNEATLY YOU DID NOT SHOW THE RESPECT THAT WAS DUE. YOUR ANSWER IS CORRECT, THEREFORE TDIAMOND DOES NEED TO AWARD TO THE POINTS TO YOU. I FEEL THAT YOU ARE TOTALLY OUT OF PLACE, AS I LOCKED THE QUESTION JUST A FEW MOMENTS AGO IN ORDER TO ANSWER THE QUESTION.

TDiamond:
Go ahead and reject the answer, as the answer I had was the same as provided by kamall.
0
 
LVL 7

Expert Comment

by:kamall
ID: 1465625
redborn:
-"IT IS COMMON PRACTICE TO LOCK A QUESTION IN ORDER TO PREPARE AN ANSWER THAT I HAD"!
This is COMPLETELY WRONG! - Who told you that???
Can you imagine how would it going to be if every expert locks every question to PREPARE an answer?. If it is going to be that way, I would have been the #1 expert since long time ago.

-"UNFORTUNEATLY YOU DID NOT SHOW THE RESPECT THAT WAS DUE"
Respect for what??? For proposing an answer without the answer?

tdiamond, sorry for using your thread, but I had to comment on redbaron's comment.
Regards
0
 

Author Comment

by:tdiamond
ID: 1465626
Hey guys,

Can't we just all get along?

Thank you both.  I greatly appreciate all your help.

P.S. - Kamall, if you have anything else to send me, my e-mail address is td@wwa.com.
0
 
LVL 7

Accepted Solution

by:
kamall earned 300 total points
ID: 1465627
tdiamond,
I've just sent you the complete project.
Regards
0
 

Expert Comment

by:vbmeister
ID: 4129835
Besides all of that Emailing an answer does nobody else on the exchange any good at all.  

I completely agree that the person who posts actual code to the EXchange as Kamall did should be the person to lock the question not somebody who says I have an answer let me email it.  Yes we can all get along but Redbaron may have needed to have this pointed out that locking and emailing just kills the thread and we all need the threads to get our answers from rather than having to ask questions everytime to get our own emailings.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now