apologies for that I stupidly used i twice in the function and have done some other 
tinkering - I never used this function for a finished product and didn't get tested 
extensively

here is a newer version:

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]
    vFileList = []
  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
      vTempFileList = baFileList(vStrPath,"*.*")
      --go through the list of the files
      --if any, and add the path to the filename
      if vTempFileList.count > 0 then
        repeat with k = 1 to vTempFileList.count
          vFileList.add(vStrPath & vTempFileList[k])
        end repeat
      end if
    end repeat
    --return the file list
    return vFileList
  end if
end


[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