Reg: Accessing files from parent folder in child folder

17 views
Skip to first unread message

VIDYA SAGAR POGIRI

unread,
Nov 27, 2015, 4:57:58 AM11/27/15
to Ruby on Rails: Talk




Hi,
I want to access the files in folder 2 from the folder 4, I mean my Present Working Directory is 4
Auto Generated Inline Image 1

Colin Law

unread,
Nov 27, 2015, 5:32:10 AM11/27/15
to Ruby on Rails: Talk
As so often is the case with questions here you have not provided nearly enough information to answer the question.

The simple answer is ../../ but that is probably not what you are after, so:

Is this a Ruby application running on a PC or a rails app?
If a rails app are you trying to access files on the client machine or on the server?
If a rails app and you are trying to access files on the server do these folders relate to the location of the rails app and what sort of 'access' are you trying to achieve (find source files, save uploaded files or what)?
What operating system are you running under?


Colin

VIDYA SAGAR POGIRI

unread,
Nov 27, 2015, 5:38:55 AM11/27/15
to rubyonra...@googlegroups.com
Windows OS
But i want to access the images in folder 1 from folder 3 and i also want the complete path of the images

Thanks,

Vidya Sagar Pogiri,
Mobile:9597992299

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLuV%3DUFEurnJb4wk8_txyjHHyFZ_Kb9zDRDcjNbWR_pJ8A%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

Colin Law

unread,
Nov 27, 2015, 5:46:04 AM11/27/15
to Ruby on Rails: Talk
On 27 November 2015 at 10:38, VIDYA SAGAR POGIRI <vidyasag...@gmail.com> wrote:
Windows OS
But i want to access the images in folder 1 from folder 3 and i also want the complete path of the images

Go back to my post and please answer *all* the questions.

Thanks

Colin
 

VIDYA SAGAR POGIRI

unread,
Nov 27, 2015, 5:56:06 AM11/27/15
to Ruby on Rails: Talk

Ruby App running on Windows
Im using Windows


What operating system are you running under?

Colin Law

unread,
Nov 27, 2015, 7:29:36 AM11/27/15
to Ruby on Rails: Talk
On 27 November 2015 at 10:56, VIDYA SAGAR POGIRI <vidyasag...@gmail.com> wrote:

Ruby App running on Windows
Im using Windows


You can use the method system or backticks to run commands such as dir and get the result back [1] [2].  When you have found the file you can open it using the normal ruby file methods.


[1] http://tech.natemurray.com/2007/03/ruby-shell-commands.html
[2] http://blog.bigbinary.com/2012/10/18/backtick-system-exec-in-ruby.html

Colin
 
Reply all
Reply to author
Forward
0 new messages