[Win32utils-devel] network drives

Zach Dennis zdennis at mktec.com
Mon Feb 7 08:42:02 EST 2005


Another nicety may be handling network drives. I've been using a ruby 
script which manipulate using the "net use" command to map network 
drives, disconnect network drives, query to see what drives are 
connected, etc..., but it'd be sweet if this type of functionality was 
included in win32 package.

Maybe usage like:
   nd = Win32::NetworkDrive.new( 'v:' , 'ComputerName', 'ShareName' )
   nd.connect( 'username' , 'password' )
   nd.disconnect

   nd = Win32::NetworkDrive.new( 'v:' , '\\ComputerName\ShareName', 
'username', 'passwod' )
   nd.connect
   nd.disconnect

   nd = Win32::NetworkDrive.new( '\\ComputerName\ShareName' )
   Win32::NetworkDrive.connected?( 'v:' ) => false
   nd.connect( 'v:' )
   nd.disconnect

   Win32::NetworkDrive.new9 '\\ComputerName\ShareName' ) do |nd|
     Dir["#{nd}"].each { |f| puts f }
   end

or something? What do you'all think?

Zach


More information about the win32utils-devel mailing list