How is the script going to be executed (manually, or by the flash)? Do you want the script to output any text (as in echo'd text, not what will be in the textfile), and how do you want them sorted (alphabetical, natural alphabetical, reverse, by name, by last modification time/date, ...)?