Solved

hard drive search

Posted on 1998-07-13
9
142 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

707 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

13 Experts available now in Live!

Get 1:1 Help Now