Does dir$ work with recursive functions? as in,
if you want to recursively go through all directories
under a subdirectory. Something like:
FUNCTION foo( d$ )
chdir d$
file$=dir$("*.x", 55)
do
if file$="" then exit loop
if attrib(file$)=16 then
foo file$
else
print file$
end if
file$ = dir$
loop
chdir ".."
END FUNCTION
[ this code was formatted, I'm not sure how to preserve it in
the post though. it apparantly ignores leading spaces. ]
The problem that I'm having is that it'll get n levels deep but
as it comes back out it won't find anything. So, in a case where
I have the following directories:
c:\
|----c:\dir1
.....|--c:\dir1\subdir1
.....|--c:\dir1\subdir2
|----c:\dir2
it'll never make it to c:\dir1\subdir2 or c:\dir2.
Please note that I just wrote this code on the fly to illustrate
my question, so since I know that it's buggy, inefficient, and not
elegant, please don't flame me.
------------------
[This message has been edited by David J Venable (edited May 08, 2002).]
if you want to recursively go through all directories
under a subdirectory. Something like:
FUNCTION foo( d$ )
chdir d$
file$=dir$("*.x", 55)
do
if file$="" then exit loop
if attrib(file$)=16 then
foo file$
else
print file$
end if
file$ = dir$
loop
chdir ".."
END FUNCTION
[ this code was formatted, I'm not sure how to preserve it in
the post though. it apparantly ignores leading spaces. ]
The problem that I'm having is that it'll get n levels deep but
as it comes back out it won't find anything. So, in a case where
I have the following directories:
c:\
|----c:\dir1
.....|--c:\dir1\subdir1
.....|--c:\dir1\subdir2
|----c:\dir2
it'll never make it to c:\dir1\subdir2 or c:\dir2.
Please note that I just wrote this code on the fly to illustrate
my question, so since I know that it's buggy, inefficient, and not
elegant, please don't flame me.
------------------
[This message has been edited by David J Venable (edited May 08, 2002).]
Comment