"The starting number (defaults to 1)") do |e|
opts.starting_number = e.to_i
end
+ myparser.on("--glob GLOB", "-g",
+ "Specify the glob expression to use. Example: '*/*.mp3'.") do |d|
+ opts.glob = d
+ end
end
parser.parse!(args)
raise "invalid num_digits: #{opts.num_digits}" unless
opts.num_digits > 0
- raise "must give an extension" unless opts.extension != nil
+ raise "must specify an extension" unless opts.extension != nil
+ if (opts.glob == nil) then
+ opts.glob = "*.#{$opts.extension}"
+ end
return opts
end
end
end
return ret
end
-#.#{$opts.extension}").sort.each do |f|
def file_iter
- Dir.glob("*.#{$opts.extension}").sort.each do |f|
+ Dir.glob($opts.glob).sort.each do |f|
yield f
end
end