Question : ruby get file folder
Answered by : mysterious-mantis-2t9yeiqzzhwz
path = "/path/to/xyz.mp4"
File.basename(path) # => "xyz.mp4"
File.extname(path) # => ".mp4"
File.basename(path, ".mp4") # => "xyz" OR
File.basename(path, ".*") # => "xyz"
File.dirname(path) # => "/path/to"
Source : https://stackoverflow.com/questions/20793180/get-file-name-and-extension-in-ruby | Last Update : Fri, 29 Jul 22
Question : get directory of current file ruby
Answered by : don-isaac
__dir__
Source : | Last Update : Sun, 02 May 21