|
-
October 12th, 2001, 11:30 AM
#1
The most efficient way to search a file
1) There are about 100,000 files in a directory, and I need to know the most efficient way to find a file in that directory.
2) Also, I'm trying to determine if directory A has over 100,000, then create directory B and put files in that directory, so that file search will not be slowed down. Then if directory B has over 100,000 files in it then create directory C, and on, and on.
Any good ideas/suggestions??
Thanks!
[email protected]
-
October 12th, 2001, 11:58 AM
#2
Re: The most efficient way to search a file
When it comes to manipulating files and folders they FileSystemObject comes in pretty handy... you'll need a reference to the Microsoft Scripting Runtime (SCRRUN.DLL)...
private Sub Command1_Click()
Dim fs as FileSystemObject
Dim f as Folder
set fs = new FileSystemObject
set f = fs.GetFolder("C:\Windows")
MsgBox "Folder " & f.Name & " has " & f.Files.Count & " files."
If fs.FileExists("C:\WINDOWS\WINSOCK.DLL") then
MsgBox "Winsock.Dll is in directory"
else
MsgBox "Winsock.dll isn't in directory"
End If
If f.Files.Count > 20 then
fs.CreateFolder ("C:\SomeNewFolder")
MsgBox "new Folder Created."
End If
End Sub
-
October 15th, 2001, 05:00 AM
#3
Re: The most efficient way to search a file
You can try using the APIs FindFirstFile and
FindNextFile
Regards,
Saurabh.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|