From: Bryan JJ Buckley Date: 2008-06-21T18:37:10+09:00 Subject: Re: File question Dir::glob is a bit more powerful than Dir::[], and it can take a block, to which the filename gets passed. ri Dir::glob has pretty comprehensive documentation on this. Dir.glob("/path/to/files/*.*-*-*.csv") do |filename| File.open("name_extra.txt", "w+") do |file| file.puts filename end end But if you need to mangle the filename, then, as Martin said, you can run a regexp on the string once you have it. 2008/6/20 Justin To : > File name: some_random_report.2008-06-20.csv > > I know which folder this file will be in, I just don't know what the > exact file name is. It should look similar to what I have above, except > everyday the date could be different. How would I search the folder for > the file? Also, I want my program to be able to open a new document > called "File name_extra.txt". How do I capture the File name into a > string, once I've figured out which file to open in the first place? > > Thanks!! > -- > Posted via http://www.ruby-forum.com/. > > -- JJ