blog.robotex.de

Ruby: Get filename without extension

file_name = "/foo/bar/baz.txt"
file_name.chomp(File.extname(file_name)) # => "/foo/bar/baz"
File.basename(file_name, '.*') # => "baz"

Back