In addition, you can always use the universal hammer: split().


fname = "C:/path/to/dir/pic10.jpg"
pieces = fname.split("/")
puts pieces[-2]   #dir

parts = pieces[-1].split(".")
puts parts[0]  #pic10



-- 
Posted via http://www.ruby-forum.com/.