Reg: Accessing files from parent folder in child folder


![Auto Generated Inline Image 1.png|298x119](upload://eyUvQDqKDzfujivT5tsRHaU6qE8.png)

Hi,
I want to access the files in folder 2 from the folder 4, I mean my Present Working Directory is 4

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

Auto Generated Inline Image 1.png

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

Auto Generated Inline Image 1.png

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

Auto Generated Inline Image 1.png

Ruby App running on Windows Im using Windows

What operating system are you running under?

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] tech.natemurray.com: 6 Ways to Run Shell Commands in Ruby [2] Executing commands in ruby - BigBinary Blog

Colin