From: Ahmet Kilic Date: 2009-08-25T17:45:11+09:00 Subject: help directory name issue... I am searching inside of the files ,like this unless /.*test/.match( file_name ) || /.*Test/.match( file_name ) text = File.read(file_name) text.scan(/find/) do |it| $files << ("#{it} ---> #{File.basename(file_name) } =====> #{File.dirname(file_name)}") end I can list the keyword, file name and directory name with path name, but i want 1- file name without any extension. for example : *.rb ,*.java, *.txt , ... 2- I want to output only last directory name. Not path name. for example: C:\\test\myfiles\, C:\\test\outputs\ .... so only I want to output myfiles and outputs directory names 3- i want to output the search keyword`s left and right side sentences also. please help me. please! -- Posted via http://www.ruby-forum.com/.