GetDirectories Performance
- From: "Tom Scales" <tjscales@xxxxxxxxx>
- Date: Sat, 22 Apr 2006 23:07:45 GMT
I'm writing a VB.NET 2003 program that uses a Treeview to display the drive
structure on the computer. I am having a major problem with performance.
The are many files on one drive (over a million) and it is killing me. For
example, one directory has a structure:
Main
------ Sub directory
-------------- 10 Sub directories, each with roughly 30,000 files.
When I execute this code on the Sub directory (i.e. strPath = SubDirectory)
'------------------------------------------------------------------------
Dim strPath As String = tn.FullPath ' Get the parent's path
Dim diDirectory As New DirectoryInfo(strPath)
Dim adiDirectories() As DirectoryInfo
Try
' Get an array of all sub-directories as DirectoryInfo objects.
adiDirectories = diDirectory.GetDirectories()
Catch exp As Exception
Exit Sub
End Try
'------------------------------------------------------------------------
it takes over 15 minutes to complete. This is on a P4-2.66 running XP Pro.
Any suggestions for improvement?
Thanks,
Tom
.
- Follow-Ups:
- Re: GetDirectories Performance
- From: Herfried K. Wagner [MVP]
- Re: GetDirectories Performance
- Prev by Date: Re: [DATE - newbie] change and set back
- Next by Date: Re: GetDirectories Performance
- Previous by thread: Load Report Failed
- Next by thread: Re: GetDirectories Performance
- Index(es):
Relevant Pages
|