Ruby, getting path from path+filename January 9, 2023 by Tarik Use the Ruby File.dirname method. File.dirname("C:/Test/blah.txt") # => "C:/Test"