Recursive search for files and out of stack error

  • Thread starter Thread starter alanwo
  • Start date Start date
For recursive search for files, like
http://support.microsoft.com/default.aspx?scid=KB;EN-US;306666, it may
lead to "out of stack" error if searching too many files, say millions
of files.
Do you all experts have any solution for this situation?

It should not have any impact on wether you get "stack overflow"
exceptions or not how many files you are finding.

However, the depth of your directory search might have that effect, but
the only way I can think of that you can get such problems with this is
if you've managed to create directory links (symlinks) to parent
directories... In other words, that C:\Temp contains a directory Test
which contains a symlink back to \Temp, which contains Test, which
contains a symlink back to \Temp, which ... well, you get the picture.

If you have experienced a stack problem with the given code, please post
the circumstances.
 
Hi Lasse,

Thanks for your response. Depth of directoris does matter but I don't
think it is possible to create symlinks in NTFS. I think the reason is
that parameters of MS's recursive search is only one, sDir.
Sub DirSearch(ByVal sDir As String)
while that of my rescursive search is too many:
Public Function LoadFiles( _
ByVal sFileSpec As String, _
minSz As Long, _
maxSz As Long, _
ProtectDir As Object, _
AnyExclusion As Boolean, _
Optional ByVal bRecursive As Boolean = False, _
Optional ByVal ModDate As String = "", _
Optional ByVal bHidden As Boolean = False, _
Optional ByVal bSrchTarget As Boolean = True, _
Optional ByRef pb = Nothing) _
As Long

What do you think?

Alan
 
Hi Lasse,

Thanks for your response. Depth of directoris does matter but I don't
think it is possible to create symlinks in NTFS. I think the reason is
that parameters of MS's recursive search is only one, sDir.
Sub DirSearch(ByVal sDir As String)
while that of my rescursive search is too many:
Public Function LoadFiles( _
ByVal sFileSpec As String, _
minSz As Long, _
maxSz As Long, _
ProtectDir As Object, _
AnyExclusion As Boolean, _
Optional ByVal bRecursive As Boolean = False, _
Optional ByVal ModDate As String = "", _
Optional ByVal bHidden As Boolean = False, _
Optional ByVal bSrchTarget As Boolean = True, _
Optional ByRef pb = Nothing) _
As Long

What do you think?

Alan
 
Back
Top