Return all paths, recursively to deepest level
Ken Ray
kray at sonsothunder.com
Sun Feb 24 20:03:01 EST 2002
David,
Thanks for the optimizations. You're right, there were a few other things I
was doing with the code. BTW: This was developed in MC, not Rev, and at the
time MC's "main" function was "directories", with "folders" as a synonym.
Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/
----- Original Message -----
From: "David Vaughan" <drvaughan55 at mac.com>
To: <use-revolution at lists.runrev.com>
Sent: Sunday, February 24, 2002 3:03 AM
Subject: Re: Return all paths, recursively to deepest level
> Ken
>
> Coincidentally, I had just stared writing a recursive directory walker
> when Siva asked for one and you supplied. Very timely, thanks.
> I noticed, however, that you use the construct "the directories" which
> proves to be a synonym for "the folders" which is the function returned
> if you search the Transcript Dictionary for "directories" or "folders".
>
> What other synonyms exist in Transcript and where are they documented?
> Are synonyms deprecated?
>
> Incidentally, below is my refinement of your code to remove redundancies
> (presumably from something else you were doing) and increase speed.
>
> regards
> David
>
> global gHierList
>
> on mouseUp
> put empty into gHierList
> -- put empty into field 1
> answer folder "Pick a folder you want to walk:"
> if it is empty then exit mouseUp
> -- put it into defFold
> directoryWalk it
> sort gHierList
> put gHierList into field 1
> -- set the defaultFolder to defFold
> end mouseUp
>
> on directoryWalk whatFolder
> set the defaultFolder to whatFolder
> put the files into temp
> repeat for each line x in temp
> put whatFolder & "/" & x & return after gHierList
> end repeat
> put the folders into tDirList
> repeat with x = 2 to the number of lines of tDirList
> directoryWalk (whatFolder & "/" & (line x of tDirList))
> end repeat
> end directoryWalk
>
> On Saturday, February 23, 2002, at 06:11 , Ken Ray wrote:
>
> > Siva, here you go:
> >
> > global gHierList,gMainFolder,gBaseLevels
> >
> > on mouseUp
> > put "" into gHierList
> > answer folder "Pick a folder you want to walk:"
> > if it = "" then exit mouseUp
> > set the itemDel to "/"
> > put it into gMainFolder
> > put the number of items of gMainFolder into gBaseLevels
> > directoryWalk gMainFolder
> > put gHierList into field 1
> > end mouseUp
> >
> > on directoryWalk whatFolder
> > set the itemDel to "/"
> > if "(2)" is in pDel then put 2 into numSpcs
> > else put 4 into numSpcs
> > put " " into spcPad
> > set the directory to whatFolder
> > put the files into temp
> > sort temp
> > repeat with x = 1 to the number of lines of temp
> > put whatFolder & "/" & (line x of temp) into line (the number of
> > lines
> > of gHierList)+1 of gHierList
> > end repeat
> > put the directories into tDirList
> > sort tDirList
> > repeat with x = 2 to the number of lines of tDirList
> > directoryWalk (whatFolder & "/" & (line x of tDirList))
> > end repeat
> > end directoryWalk
> >
> >
> > Enjoy!
> >
> > Ken Ray
> > Sons of Thunder Software
> > Email: kray at sonsothunder.com
> > Web Site: http://www.sonsothunder.com/
> >
> > ----- Original Message -----
> > From: "Sivakatirswami" <katir at hindu.org>
> > To: "Metacard List" <metacard at lists.runrev.com>;
> > <use-revolution at lists.runrev.com>
> > Sent: Friday, February 22, 2002 11:38 PM
> > Subject: Return all paths, recursively to deepest level
> >
> >
> >> Aloha:
> >>
> >> I think about 2 years ago Kevin or Richard sent me a script that would
> >> return the full path for all folders and files, recursively down from
> >> the
> >> current working directory... but I can't seem to find that script...
> >> Also
> > I
> >> can't seem to find the archives any more for the metacard card list
> > serve...
> >>
> >> Does anyone have such a script? One could use Rinaldi's getDir
> >> external,
> > and
> >> just replace the ":" with "/" in the list returned but that would not
> >> be
> >> cross platform... the returned output from the function would look
> >> like
> >> this:
> >>
> >> MyHardDrive/MetaCard 2.3.1/ KT Stacks
> >> MyHardDrive/MetaCard 2.3.1/ KT Stacks/ INNERSEARCH
> >> MyHardDrive/MetaCard 2.3.1/ KT Stacks/ INNERSEARCH/Drums hi 2
> >> MyHardDrive/MetaCard 2.3.1/ KT Stacks/ INNERSEARCH/Drums hi
> >> fidelity.aiff
> >> MyHardDrive/MetaCard 2.3.1/ KT Stacks/ INNERSEARCH/images
> >> MyHardDrive/MetaCard 2.3.1/ KT Stacks/ INNERSEARCH/images/0616001
> >> Ocean
> > Sky
> >> .pict
> >> MyHardDrive/MetaCard 2.3.1/ KT Stacks/Dev Tools-Practice
> >> MyHardDrive/MetaCard 2.3.1/ KT Stacks/Dev Tools-Practice/heim2.mc
> >>
> >>
> >> etc. down through to the deepest sub folder and it's files.
> >>
> >> TIA
> >>
> >> Hinduism Today
> >>
> >> Sivakatirswami
> >> Editor's Assistant/Production Manager
> >> katir at hindu.org
> >> www.HinduismToday.com, www.HimalayanAcademy.com,
> >> www.Gurudeva.org, www.hindu.org
> >>
> >> Read The Master Course Lesson of the Day at
> >> http://www.gurudeva.org/lesson.shtml
> >>
> >> _______________________________________________
> >> metacard mailing list
> >> metacard at lists.runrev.com
> >> http://lists.runrev.com/mailman/listinfo/metacard
> >> _______________________________________________
> >> use-revolution mailing list
> >> use-revolution at lists.runrev.com
> >> http://lists.runrev.com/mailman/listinfo/use-revolution
> >>
> >
> > _______________________________________________
> > use-revolution mailing list
> > use-revolution at lists.runrev.com
> > http://lists.runrev.com/mailman/listinfo/use-revolution
> >
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
More information about the use-livecode
mailing list