ierate through folders & subfolders (again)

Jan 19, 2007 at 8:03am

ierate through folders & subfolders (again)

Hello,

i can’t get a hand on the workaround i made before to output all the
files contained in a path, including those in subfolders & subfolders of
subfolders. This is a school example we could prototype on a piece of
paper, i guess, but i’ve decided i am only a musician this month, so the
logic of this code keep avoiding me (or the reverse).

I don’t need the job’s done, not at all, but i would appreciate to hear
about the structure of the loop (or the loops) needed to achieve this in
a clean, short & beautiful piece of code… After that, i could be
easily ported to Java, C, whatever.

nb: yes i know folderiter.js example very well, yes jhno wrote a
folderiter external but i don’t have the sources.

best regards

f.e

f.e chanfrault | aka | personal computer music
> >>>>>> http://www.personal-computer-music.com
> >>>>>> |sublime music for a desperate people|

#29799
Jan 19, 2007 at 8:54am

Hi f.e.,

On 19 janv. 07, at 09:03, f.e wrote:

> Hello,
>
> i can’t get a hand on the workaround i made before to output all the
> files contained in a path, including those in subfolders & subfolders
> of subfolders.

< ...>

> nb: yes i know folderiter.js example very well

Everything is in folderiter.js’ recursefolders function, so what’s your
problem?

There is one single loop, used to treat sequencially all the items in
the current folder. If the current item is a folder, then the function
is _recursively_ called with the folder’s path as argument. So the
top->bottom iteration is done thru the recursion, the horizontal one
(in one folder) is done thru the loop.

Hope it helps.

p

#93760
Jan 19, 2007 at 11:45am

Hello Patrick,

hope you’re well. You are absolutely right. After a second check and a
few tweaks, the recursefolder function is ok. I don’t know why but if
failed a lot before, probably because of an erroneous syntax of mine.

Thanks a lot & cheers

f.e

f.e chanfrault | aka | personal computer music
> >>>>>> http://www.personal-computer-music.com
> >>>>>> |sublime music for a desperate people|

Patrick Delges wrote:
> Hi f.e.,
>
> On 19 janv. 07, at 09:03, f.e wrote:
>
>> Hello,
>>
>> i can’t get a hand on the workaround i made before to output all the
>> files contained in a path, including those in subfolders & subfolders
>> of subfolders.
>
> < ...>
>
>> nb: yes i know folderiter.js example very well
>
> Everything is in folderiter.js’ recursefolders function, so what’s
> your problem?
>
> There is one single loop, used to treat sequencially all the items in
> the current folder. If the current item is a folder, then the function
> is _recursively_ called with the folder’s path as argument. So the
> top->bottom iteration is done thru the recursion, the horizontal one
> (in one folder) is done thru the loop.
>
> Hope it helps.
>
> p
>
>

#93761

You must be logged in to reply to this topic.