On 7/25/07, Peter Bailey <pbailey / bna.com> wrote:
> Why is it that File.basename works for me for one single file, but, it
> doesn't work for an array of files. Here's an example of what worked for
> me for one file; then, it didn't work for multiple files.
>
> Thanks,
> Peter
>
>
> file    = "va998.tif"
> pdffile = File.basename(file, ".tif") + ".pdf"
> puts "#{file}   #{pdffile}"
>
>    yields:
>    va998.tif   va998.pdf
>
>
> Dir.glob("*.tif").each do |tiffile|
> pdffile = File.basename(tiffile, ".tif") + ".pdf"
> puts "#{tiffile}   #{pdffile}"
> end

Works for me - what ruby version and OS? Try

p Dir.glob("*.tif")

p Dir.glob("*.tif").map {|f| File.basename(f, ".tif")}

and see if either one looks visibly funny.

martin