루비는 디스크 드라이브를 사용할 수 있습니다
문제
루비에서 사용 가능한 디스크 드라이브 목록을 얻을 수있는 방법을 알려 줍니까?열린 파일 대화를 만들고 알아야 할 필요가 있습니다!미리 감사드립니다. 엘.
해결책
Brian 기사는 다음 코드를 올바르게 주도했습니다.
require 'win32ole'
file_system = WIN32OLE.new("Scripting.FileSystemObject")
drives = file_system.Drives
drives.each do |drive|
puts "Available space: #{drive.AvailableSpace}"
puts "Drive letter: #{drive.DriveLetter}"
puts "Drive type: #{drive.DriveType}"
puts "File system: #{drive.FileSystem}"
puts "Is ready: #{drive.IsReady}"
puts "Path: #{drive.Path}"
puts "Root folder: #{drive.RootFolder}"
puts "Serial number: #{drive.SerialNumber}"
puts "Share name: #{drive.ShareName}"
puts "Total size: #{drive.TotalSize}"
puts "Volume name: #{drive.VolumeName}"
end
. 제휴하지 않습니다 StackOverflow