Directory Walker Conundrum

Alex Tweedly alex at tweedly.net
Sun May 28 19:52:59 EDT 2006


Sivakatirswami wrote:

> I'm using an old Ken Ray stand by for directory walks.  I discovered  
> a "bug" here where, if the folder name begins with a space, it is  
> skipped. I cannot for the life of me figure out why...
>
> on directoryWalk whatFolder
>   set the itemDel to "/"
>   set the directory to whatFolder
>   put the files into  tFiles
>   put the files into temp
>   add the number of lines of temp to tCount
>   sort temp
>   repeat for each line x in temp
>     put whatFolder & "/" & x & cr after gHierList
>   end repeat
>   put the folders into tDirList
>   sort tDirList

now the folder with a leading space in its name comes before the ".."

>   delete line 1 of tDirList

And is now deleted :-(

>   repeat for each line x in tDirList
>     if x = ".."  then next repeat
>     directoryWalk (whatFolder & "/" & x)
>   end repeat
> end directoryWalk

change
   delete line 1 of tDirList
to something like
   filter tDirList without ".."


-- 
Alex Tweedly       http://www.tweedly.net



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.7.2/349 - Release Date: 26/05/2006




More information about the use-livecode mailing list