Re: Return all paths, recursively to deepest level
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: [EMAIL PROTECTED] Web Site: http://www.sonsothunder.com/ - Original Message - From: "David Vaughan" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] > > Web Site: http://www.sonsothunder.com/ > > > > - Original Message - > > From: "Sivakatirswami" <[EMAIL PROTECTED]> > > To: "Metacard List" <[EMAIL PROTECTED]>; > > <[EMAIL PROTECTED]> > > 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
Re: Return all paths, recursively to deepest level
At 1:03 AM -0800 2/24/2002, David Vaughan wrote: >What other synonyms exist in Transcript and where are they documented? In the entry for each term that has one or more synonyms. (Look below the term.) >Are synonyms deprecated? No. -- Jeanne A. E. DeVoto ~ [EMAIL PROTECTED] http://www.runrev.com/ Runtime Revolution Limited - Power to the Developer! ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Return all paths, recursively to deepest level
Sivakatirswami wrote/ schreef: > 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... > [snip] I made something myself, have a look below. Your list would be possible with: answer folder "Choose dir to dig..." if the result is "Cancel" the exit to top put relPath(deepFiles(it),it) into field "tFiles" Regards, / Groeten, Sjoerd --- SCRIPT --- function deepFiles startDir set the cursor to busy if it is "Cancel" then exit to top set the directory to startDir local tFiles repeat for each line tFile in the files put startDir & "/" & tFile into line (the number of lines in tFiles + 1) of tFiles end repeat repeat for each line tDir in line 2 to -1 of the directories put deepFiles(startDir & "/" & tDir) into line (the number of lines in tFiles + 1) of tFiles set the directory to startDir end repeat return tFiles end deepFiles function relPath absFiles,absDir repeat for each line tFile in absFiles put oneRelPath(tFile,absDir) into line (the number of lines in relFiles + 1) of relFiles end repeat return relFiles end relPath function oneRelPath absFile,absDir set itemDel to "/" repeat forever if item 1 of absDir = item 1 of absFile then delete item 1 of absFile delete item 1 of absDir else put repeatString("../",the number of items in absDir) before absFile exit repeat end if end repeat return absFile end oneRelPath function repeatString rString,rTimes local repeatedString repeat for rTimes times put rString after repeatedString end repeat return repeatedString end repeatString ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
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: [EMAIL PROTECTED] > Web Site: http://www.sonsothunder.com/ > > - Original Message - > From: "Sivakatirswami" <[EMAIL PROTECTED]> > To: "Metacard List" <[EMAIL PROTECTED]>; > <[EMAIL PROTECTED]> > 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 >> [EMAIL PROTECTED] >> 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 >> [EMAIL PROTECTED] >> http://lists.runrev.com/mailman/listinfo/metacard >> ___ >> use-revolution mailing list >> [EMAIL PROTECTED] >> http://lists.runrev.com/mailman/listinfo/use-revolution >> > > ___ > use-revolution mailing list > [EMAIL PROTECTED] > http://lists.runrev.com/mailman/listinfo/use-revolution > ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Return all paths, recursively to deepest level
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: [EMAIL PROTECTED] Web Site: http://www.sonsothunder.com/ - Original Message - From: "Sivakatirswami" <[EMAIL PROTECTED]> To: "Metacard List" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> 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 > [EMAIL PROTECTED] > 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 > [EMAIL PROTECTED] > http://lists.runrev.com/mailman/listinfo/metacard > ___ > use-revolution mailing list > [EMAIL PROTECTED] > http://lists.runrev.com/mailman/listinfo/use-revolution > ___ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution