List of drives?

R

ruby talk

------=_Part_669_7983587.1137728854010
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Is there a way in ruby with out extra libraries to get a list of drives?
hard drives, dvd drives, network drives, ...?

Becker

------=_Part_669_7983587.1137728854010--
 
D

Dave Burt

E

Eivind Eklund

Is there a way in ruby with out extra libraries to get a list of drives?
hard drives, dvd drives, network drives, ...?

No.

This is highly operating system specific, and it's even hard to
define, especially when you include "network drives".

Eivind.
 
P

Pau Garcia i Quiles

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Is there a way in ruby with out extra libraries to get a list of drives?
hard drives, dvd drives, network drives, ...?

Becker

For Unix/Linux/MacOSX it would be rather easy, just run `mount` and parse the
output.

For Windows, you may just test every unit A: to Z:. You'll need to access the
Win32 API to look for volumes without an assigned mount point (unit letter),
such as SAN mounted volumes.

I don't know how to do it in Mac OS Classic, I never used those versions of
Mac OS.

- --
Pau Garcia i Quiles
http://www.elpauer.org
(En general no puedo contestar antes de 10 días)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFD07h3/DzYv9iGJzsRAij+AKDLue7QnBIR0XjjEjHA3/BhclWKMQCeNMZ+
XH3pA57PL6QAipj5yGPbjcA=
=iKiS
-----END PGP SIGNATURE-----
 
W

Wilson Bilkovich

Is there a way in ruby with out extra libraries to get a list of drives?
hard drives, dvd drives, network drives, ...?

On Windows systems, you can do:
require 'win32ole'
drives =3D []
file_system =3D WIN32OLE.new( 'Scripting.FileSystemObject' )
file_system.Drives.each { |drive| drives << drive.DriveLetter }
#drives now contains a list of existing drive letters.
puts drives

There are other useful properties on the 'drive' object, including
ShareName, which will tell you the network path, for remote volumes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top