How I can get name of file?


#1

I have this is string:
/adfsd/dfsdf/funny-videos—gay-fight.mpeg

and I have this code:
@original_file_path = file_path
name = @original_file_path.match(//[a-zA-Z0-9_-]+./)
if name
puts name.values_at(0)
end

Result of code is
/funny-videos—gay-fight.

I want to get it: funny-videos—gay-fight
how I can get name of file?


#2

On 5/25/06, Ilyas removed_email_address@domain.invalid wrote:

I have this is string:
/adfsd/dfsdf/funny-videos—gay-fight.mpeg
[snip]

I want to get it: funny-videos—gay-fight
how I can get name of file?

irb(main):001:0>
File.basename(’/adfsd/dfsdf/funny-videos—gay-fight.mpeg’, ‘.mpeg’)
=> “funny-videos—gay-fight”

Ryan