473,796 Members | 2,904 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Recursive search for files and out of stack error

For recursive search for files, like
http://support.microsoft.com/default...B;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?

Sep 6 '05 #1
3 1593
al****@gmail.co m wrote:
For recursive search for files, like
http://support.microsoft.com/default...B;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.

--
Lasse Vågsæther Karlsen
http://www.vkarlsen.no/
mailto:la***@vk arlsen.no
PGP KeyID: 0x2A42A1C2
Sep 6 '05 #2
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

Lasse Vågsæther Karlsen wrote:
al****@gmail.co m wrote:
For recursive search for files, like
http://support.microsoft.com/default...B;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.

--
Lasse Vågsæther Karlsen
http://www.vkarlsen.no/
mailto:la***@vk arlsen.no
PGP KeyID: 0x2A42A1C2


Sep 19 '05 #3
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

Lasse Vågsæther Karlsen wrote:
al****@gmail.co m wrote:
For recursive search for files, like
http://support.microsoft.com/default...B;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.

--
Lasse Vågsæther Karlsen
http://www.vkarlsen.no/
mailto:la***@vk arlsen.no
PGP KeyID: 0x2A42A1C2


Sep 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
9056
by: Victor | last post by:
Hello, I've got a situation in which the number of (valid) recursive calls I make will cause stack overflow. I can use getrlimit (and setrlimit) to test (and set) my current stack size. However, it is not as straightforward to determine the base address for my stack space. The approach I have taken is to save the address of an automatic variable in main( ), and assume this is a fairly good indicator of my base address. Then, I can...
14
1917
by: BQ | last post by:
Due to a lack of resources, I have to translate the following recursive function in its iterative form. It's a kind of dichotomic search. void SearchSlaves(unsigned long start_uid, unsigned long end_uid) { char ret; //ping over a range of addresses (all slaves with uid in the range from start_uid to end_uid will reply) ret = PingSlave(start_uid,end_uid);
9
13219
by: Bill Borg | last post by:
Hello, I call a function recursively to find an item that exists *anywhere* down the chain. Let's say I find it five layers deep. Now I've got what I need and want to break out of that whole stack and continue execution at the point of the initial call. Is that possible? Thanks, Bill
3
310
by: alanwo | last post by:
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?
3
2801
by: Ameen | last post by:
I am very new to programming and VB.net, and I wrote the code below, but it seem to go on an infinite loop. Please tell me what I am doing wrong. Private Sub search(ByVal indexstart) Pos1 = LineNoSpace.IndexOf("<!--", indexstart) 'checks for the begining of the comment While Pos1 = -1 And Not (line Is Nothing) ' keep checking till
3
2208
by: Robertico | last post by:
I'am new to php and have a question about a recursive file search. I'd like to do a recursive search for jpg-files and add the filenames (full path) to a mysql database. I appreciate any help ! Regards, Robertico
13
2087
by: jm.suresh | last post by:
Hi, I have a program which literately finds the object that overlapping a point. The horizontal and vertical search are called recursively from inside each other. Is this way of implementation fill the stack space with the local variables inside each call. If this is not good, is there a better way to implement? Or python itself will understand that the calls happen in the last line, so local variables need not be pushed into the stack?
9
1714
by: Lloyd Sheen | last post by:
For all those who don't think that a recursive search of files in folders is a good thing in the Microsoft.VisualBasic.FileIO.FileSystem namespace listen to this. I am reorg my mp3 collection. I have written my own catalog program and it has xml files to cache info from tags etc. To ensure that the process goes ok I went to delete all the xml files to force a rescan of the tags. This should be simple ..... but this is Vista. So...
10
1764
by: pereges | last post by:
How to to go about this ? Suppose a malloc inside a recursive function has failed and you want to set the error flag and return it to the calling function(the one which called the recursive function in the first place)
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9535
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10467
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
7558
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6802
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4130
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2931
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.