Page 1 of 1

Contents of a folder?

Posted: Wed Sep 30, 2009 2:33 am
by TodayIsTheDay
I can open a text file that's in a folder, read it's contents, then put that into a text box...

Is there a way to fill a text box with the file names that are in a folder?

If all the files in that folder are text files, is there a way to go through each file, open, read and then load the contents of each into a text box?

Thanks!

Posted: Wed Sep 30, 2009 2:47 am
by FourthWorld
See the RevTalk Dictionary entry for "files" function, which returns a return-delimited list of the contenst of the working directory. You can save the current directory, change it to what you need, get "the files", and change it back, a la:

Code: Select all

function FileList pPath
  put the directory into tSaveDir
  set the directory to pPath
  put the files into tFiles
  set the directory to tSaveDir
  return tFiles
end FileList