G
Gilbert Rebhan
Hi,
i have a dir like that and need the
first part of the first filename =
J:\test>dir /B
20070921_0001.xml
20070921_0002.xml
20070921_0003.xml
i tried with =
str=File.basename(Dir["J:/test/*.xml"].sort[0]).gsub(/(\w{8}).+/, $1)
but =
TypeError: can't convert nil into String
from (irb):4:in `gsub'
from (irb):4
from :0
if i use =
irb(main):005:0> str=File.basename(Dir["J:/test/*.xml"].sort[0])
=> "20070921_0001.xml"
i get the filename
how to change my gsub part to make it work, i want
the first part of the filename, i.e.
filename "20070921_0001.xml"
i want "20070921"
Regards, Gilbert
i have a dir like that and need the
first part of the first filename =
J:\test>dir /B
20070921_0001.xml
20070921_0002.xml
20070921_0003.xml
i tried with =
str=File.basename(Dir["J:/test/*.xml"].sort[0]).gsub(/(\w{8}).+/, $1)
but =
TypeError: can't convert nil into String
from (irb):4:in `gsub'
from (irb):4
from :0
if i use =
irb(main):005:0> str=File.basename(Dir["J:/test/*.xml"].sort[0])
=> "20070921_0001.xml"
i get the filename
how to change my gsub part to make it work, i want
the first part of the filename, i.e.
filename "20070921_0001.xml"
i want "20070921"
Regards, Gilbert