bubke Posted February 5, 2008 Share Posted February 5, 2008 Hello, Does anyone have an example for random reading files from a directory? I want to read a sequence of files, but the program must it read random. To read files from a directory is no problem, but i can't figure it out how to do it random. Grtz, bubke Link to comment Share on other sites More sharing options...
Achilles Posted February 5, 2008 Share Posted February 5, 2008 Look at the functions _FileListToArray and Random.. You could use _FileListToArray to find out all the files in an directory, and then random to get a random file. This is an untested version of what you want to do: $temp = _FileListToArray("C:\", "*.*", 1) FileRead($temp[Random(1, UBound($temp) - 1]) My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
bubke Posted February 5, 2008 Author Share Posted February 5, 2008 Thank you, you set me on the right path! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now