I am relatively new to Ruby and need to write a script that will handle mulitple input files. It should be called like so:
script.rb -i file*
where the directory contains multiple files, like file1.xml, file2.xml and so on.
Just a quick question: How will this wildcard be expanded? Do I need to program that in my script? I am using the OptionParser Class for parsing commandline arguments.
Thanks!
The wildcard is expanded by the command line so you’ll get a list of each file in the directory
If you do,
Ruby converts string *.txt into the matching filenames and pass in the
expanded array as the new argument.
Using optparse:
Will print out:
Will result in options[:files] being an array of strings
http://www.ruby-forum.com/topic/111252