Display Dir contents

Hi,

I am automating a few processes in my office - creating customer files
and folders that then need to be worked with manually. Once they have
been created, I need to open the root folder and display it with it’s
contents, so that the user can then work directly on the files without
having to navigate to the folder.

Is there a way with ruby to pop a folder open and to the top of the z
order? Couldn’t find anything by googling.

(The machines in the office all run win7)

Thanks

Paul

On 2/28/2011 13:20, paul h wrote:

(The machines in the office all run win7)

Since this only needs to be a Windows solution, try the following:

system(“start C:/path/to/interesting/directory”)

This will kick off the Windows file browser to the path you indicate.
Take care to quote the path if it may have spaces in it.

-Jeremy

Am 28.02.2011 20:20, schrieb paul h:

(The machines in the office all run win7)

Thanks

Paul

Something like this (untested)?

system(“explorer.exe C:\your\folder”)

(Note the double backslash, you must escape backslashes in Ruby strings
if you type them in literally)

Vale,
Marvin

No need for funky escaping. Just use single-quotes instead

system(‘explorer.exe C:\your\folder’)

HTH,

-Kalman H.

On Mon, Feb 28, 2011 at 9:01 PM, Kalman H. [email protected]
wrote:

No need for funky escaping. Just use single-quotes instead

system(‘explorer.exe C:\your\folder’)

Windows happily accepts forward slashes, too:

system “explorer C:/your/folder/path”


Phillip G.

Though the folk I have met,
(Ah, how soon!) they forget
When I’ve moved on to some other place,
There may be one or two,
When I’ve played and passed through,
Who’ll remember my song or my face.

Phillip G. wrote in post #984544:

On Mon, Feb 28, 2011 at 9:01 PM, Kalman H. [email protected]
wrote:

No need for funky escaping. Just use single-quotes instead

system(‘explorer.exe C:\your\folder’)

Windows happily accepts forward slashes, too:

system “explorer C:/your/folder/path”


Phillip G.

Though the folk I have met,
(Ah, how soon!) they forget
When I’ve moved on to some other place,
There may be one or two,
When I’ve played and passed through,
Who’ll remember my song or my face.

Thanks to everyone who replied - it’s just what I need. I hadn’t seen
the system method before but have just read up on it and it is going to
be useful in additional features I want to implement.

Cheers

Paul

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs