473,806 Members | 2,248 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 1594
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
9058
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
13225
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
2804
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
2210
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
2088
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
1717
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
9596
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
10617
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
10370
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6876
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
5545
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4328
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
3
3008
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.