benjohn
4/1/2006 12:47:00 PM
On 1 Apr 2006, at 13:41, Joshua Muheim wrote:
> Hi all
>
> I'd like Ruby to open a folder, search it for files and then store all
> files names of .png files in an array and close the folder. So after
> this I can do anything I like with the png files in the array...
>
> How do I do this? Thanks a lot for help. :-)
> Joshua
You'll want the class Dir, and the class method glob.
png_files = Dir.glob(File.join(path_of_folder, '*.png'))
Cheers,
Benj