Sign in to follow this  
Followers 0
bubke

Random read files from a directory

3 posts in this topic

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

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites

Thank you, you set me on the right path!

Share this post


Link to post
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
Sign in to follow this  
Followers 0