Add to Favorites    Make Home Page 44 Online  
 Language Categories  
 Our Services  

Home » ASP Home » Files Home » DirSrch Object


Search Projects & Source Codes:

Title DirSrch Object
Description The DirSrch object recursively searches all directories for a specified folder
name or partial directory path. Use DirSrch to locate essential folders whose
paths are not known.

object.StartDirectory = starting directory
StartDirectory specifies where to begin looking for matching directories. All
directories under the start directory will be recursively searched.

object.LookingFor = folder name or partial path
LookingFor is the path fragment or directory name to search for. Anything set
in LookingFor will be matched to any part of a directory path.

Execute performs the search. The time to complete a search is dependent on
the start directory and the size of the drive being searched. Execute must be
called before calling any other methods.

Returns a long specifying the number of matching directories found.

Returns a collection (array) of matching absolute directory paths.
Category ASP » Files
Hits 3176
Code Select and Copy the Code
<% Class DirSrch Private strTmp1, strTmp2, gblMatches, bExecuted Private Sub Class_Initialize() bExecuted = False End Sub Private Function FindDir(ByVal directory, ByVal DirToFind) If Len( directory ) = 0 And Len( dirtofind ) = 0 Then FindDir = "" & vbCrLf Exit Function End If Dim objFSO, fldr, folder, tmp Set objFSO = Server.CreateObject(_ "Scripting.FileSystemObject") Set fldr = objfso.getfolder(directory) For Each folder In fldr.subfolders If UCase( ) = _ UCase( DirToFind ) Then tmp = tmp & folder.path & vbCrLf ElseIf InStr( UCase( folder.path ), _ UCase( DirToFind ) ) Then tmp = tmp & folder.path & vbCrLf Else ' tmp = join(tmp, vbCrLf) tmp = tmp & FindDir( _ folder.path, DirToFind ) End If Next Set fldr = Nothing Set objfso = Nothing FindDir = tmp End Function Public Sub Execute() Dim a, b a = Split( FindDir( StartDirectory, _ LookingFor ), vbCrLf ) b = UBound(a) - 1 ReDim Preserve a(b) gblMatches = a bExecuted = True End Sub Public Function MatchingDirs() If Not bExecuted Then Err.Raise 5199, "DirSrch Class", _ "Cannot Call 'MatchingDirs' before " & _ "calling the 'Execute' method." Exit Function End If MatchingDirs = gblMatches End Function Public Function CountMatches() If Not bExecuted Then Err.Raise 5199, "DirSrch Class", _ "Cannot Call 'CountMatches' before " & _ "calling the 'Execute' method." Exit Function End If CountMatches = CLng( UBound( gblMatches ) + 1 ) End Function Public Property Let StartDirectory(ByVal strInput) strTmp1 = strInput End Property Public Property Let LookingFor(ByVal strInput) strTmp2 = strInput End Property Public Property Get StartDirectory() If Len( strTmp1 ) = 0 Then Err.Raise 5199, "DirSrch Class", _ "You must set the 'StartDirectory' property " & _ "before calling the 'Execute' method." Exit Property End If StartDirectory = strTmp1 End Property Public Property Get LookingFor() If Len( strTmp2 ) = 0 Then Err.Raise 5199, "DirSrch Class", _ "You must set the 'LookingFor' property " & _ "before calling the 'Execute' method." Exit Property End If LookingFor = strTmp2 End Property End Class %>

Related Source Codes

Script Name Author
ııııııııııııııııııııı VyomWorld
Resistor color code reader A.Chermarajan.
Telephone Directory dhivya
card swapping game (Mini Project) nityanand
simple hangman-pascalsource Seabert
college dirtectory (Mini Project) msridhar
Poll Application John van Meter
ASP Daily Hit Counter. Tejaskumar Gandhi
To avoid null in asp environment using sql Sami
Maklumbalas webmaster
poll John van Meter
EasyASP Template Engine. TjoekBezoer
Basic Calculator using HTML & Javascript. Patrick M. D Souza
What servers support ASP ? VyomWorld
What is ASP? VyomWorld


Google Groups Subscribe to SourceCodesWorld - Techies Talk

Free eBook - Interview Questions: Get over 1,000 Interview Questions in an eBook for free when you join JobsAssist. Just click on the button below to join JobsAssist and you will immediately receive the Free eBook with thousands of Interview Questions in an ebook when you join.

New! Click here to Add your Code!

ASP Home | C Home | C++ Home | COBOL Home | Java Home | Pascal Home
Source Codes Home Page


Google Search


Source Codes is a part of Vyom Network.

Vyom Network : Web Hosting | Dedicated Server | Free SMS, GRE, GMAT, MBA | Online Exams | Freshers Jobs | Software Downloads | Interview Questions | Jobs, Discussions | Placement Papers | Free eBooks | Free eBooks | Free Business Info | Interview Questions | Free Tutorials | Arabic, French, German | IAS Preparation | Jokes, Songs, Fun | Free Classifieds | Free Recipes | Free Downloads | Bangalore Info | Tech Solutions | Project Outsourcing, Web Hosting | GATE Preparation | MBA Preparation | SAP Info | Software Testing | Google Logo Maker | Freshers Jobs

Sitemap | Privacy Policy | Terms and Conditions
Copyright ©2003-2020, All Rights Reserved.
Page URL:

Download Yahoo Messenger | Placement Papers | Free SMS | C Interview Questions | C++ Interview Questions | Quick2Host Review