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?
on 2006-05-25 22:07
on 2006-05-25 22:15
On 5/25/06, Ilyas <firstname.lastname@example.org> 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