geeting full path name of a file

3 views
Skip to first unread message

Jagan

unread,
Dec 6, 2007, 11:01:22 AM12/6/07
to Ruby on Rails: Talk
Hello all,


how can i get the full path name of a file.like i have file called
"example.csv". in "D " drive .

when i am using IE with rails i am geeting the full path name .but
when i am using it with firefox i am just getting the filename. is
there any way i could get the full path name


thanks
Jagan

Matt White

unread,
Dec 6, 2007, 3:04:11 PM12/6/07
to Ruby on Rails: Talk
What method are you currently using?

Jagan Mohan Jasti

unread,
Dec 6, 2007, 3:13:55 PM12/6/07
to rubyonra...@googlegroups.com
Hi Matt,


I am not using any method for getting the path.As i select the file
name in IE its prinitng the full path of the file as file name in IE
where as in fire fox ,its not printing the fullpath when i am using
the file name that i used in IE.is there any method in ruby which
i can use in for getting the full path of the file

Thanks
Jagan

Matt White

unread,
Dec 6, 2007, 3:24:39 PM12/6/07
to Ruby on Rails: Talk
Is File.expand_path(filename) what you're looking for?

On Dec 6, 1:13 pm, "Jagan Mohan Jasti" <jaganmohan.ja...@gmail.com>
wrote:
> Hi Matt,
>
> I am not using any method for getting the path.As i select the file
> name in IE its prinitng the full path of the file as file name in IE
> where as in fire fox ,its not printing the fullpath when i am using
> the file name that i used in IE.is there any method in ruby which
> i can use in for getting the full path of the file
>
> Thanks
> Jagan
>

Adam Teale

unread,
Jun 25, 2008, 11:52:33 AM6/25/08
to rubyonra...@googlegroups.com
Jagan did you ever manage to work this out? I need to do the same thing

Thanks!
--
Posted via http://www.ruby-forum.com/.

Saurabh H.

unread,
Mar 28, 2013, 6:17:00 AM3/28/13
to rubyonra...@googlegroups.com
Don't want to revive a 5 year old thread. But for those who came here
looking for answers, this is how I got it:

require 'pathname'
filepath = some_valid_path
Pathname.new(filepath).realpath.to_s

The thing to note is that realpath expects the file to exist.
Reply all
Reply to author
Forward
0 new messages