Jump to content

Random read files from a directory


bubke
 Share

Recommended Posts

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...