?
Solved

hard drive search

Posted on 1998-07-13
9
Medium Priority
?
151 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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 1200 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses

777 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