I used budapi for such a recursion project

here's some code I used (it was quite quick but others might be able to optimise it):

on GetFiles(vFolderList)
  
  --a recursive function which goes through all of the folders
  --dropped on the stage and test them for sub-folders
  --if folders are added
  
  --check to see that that a list has been passed
  --if not create one
  if not listP(vFolderList) then
    vFolderList = [vFolderList]
  end if
  
  if vFolderList.count > 0 then
    --go through the list of folders
    repeat with i = 1 to vFolderList.count
      --check to see whether there are sub-folders present
      if(baFolderList(vFolderList[i]).count) > 0 then
        --if there are subfolders present
        --add them to a temporary list
        vTempFolderList = baFolderList(vFolderList[i])
        repeat with j = 1 to vTempFolderList.count
          --go through the list and rebuild the pathname
          --and add them to the list of folders to be recursed
          vFolderList.add(vFolderList[i] & vTempFolderList[j] & "\")
        end repeat
      end if
      --when finished going through the folder
      --get the path to the folder
      vStrPath = vFolderList[i]
      --get the files in the folder
      vFileList = baFileList(vStrPath,"*.*")
      --go through the list of the files
      --if any, and add the path to the filename
      if vFileList.count > 0 then
        repeat with i = 1 to vFileList.count
          vFileList[i] = vStrPath & vFileList[i]
        end repeat
        --return the file list
        return vFileList
      end if
    end repeat
  end if
  
end

try it with the method getFiles("c:\") and see what happens

hth

Fraser

>Hi list,
>
>I need to develop an application that will dig the hard drive, folders and
>subfolders, and search for font files.
>I'm using DirectOS xtra to know if it's a folder or a file. But things is
>not going right. My script is very slow and left folders behind. There's
>anyone with a good idea in search folders and subfolders?
>
>thank's in advance
>
>Rodrigo
>
>[To remove yourself from this list, or to change to digest mode, go to 
>http://www.penworks.com/lingo-l.cgi  To post messages to the list, email [EMAIL 
>PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping 
>with programming Lingo.  Thanks!]


[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email [EMAIL 
PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping 
with programming Lingo.  Thanks!]

Reply via email to