Wilson Bilkovich
1/23/2006 4:18:00 PM
On 1/19/06, ruby talk <rubytalk@gmail.com> wrote:
> 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 = []
file_system = 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.