ruby get the folder path via file path code example Example: ruby filename from path path = "/path/to/file.ext" File.basename(path) # 'file.ext'