hyperic / sigar

System Information Gatherer And Reporter
http://sigar.hyperic.com/
Apache License 2.0
1.52k stars 504 forks source link

cannot get U disk on win7 x86_64 #116

Open wangfei304187 opened 6 years ago

wangfei304187 commented 6 years ago

Version: win7 x86_64 Sigar 1.6.4 jdk8

On win7 "I:\" is Removable Disk.

wmic:root\cli>LOGICALDISK Access Availability BlockSize Caption Compressed ConfigManagerErrorCode ConfigManagerUserConfig CreationClassName Description DeviceID DriveType ErrorCleared ErrorDescription ErrorMethodology FileSystem FreeS 0 C: FALSE Win32_LogicalDisk Local Fixed Disk C: 3 NTFS 34530 0 D: FALSE Win32_LogicalDisk Local Fixed Disk D: 3 NTFS 18205 0 E: FALSE Win32_LogicalDisk Local Fixed Disk E: 3 NTFS 23131 0 F: FALSE Win32_LogicalDisk Local Fixed Disk F: 3 NTFS 17012 G: Win32_LogicalDisk CD-ROM Disc G: 5 0 I: FALSE Win32_LogicalDisk Removable Disk I: 2 FAT32 32613 0 W: FALSE Win32_LogicalDisk Network Connection W: 4 NTFS 11823

wmic:root\cli>

Java Code

public class FindDisk { public static void main(String[] args) throws Exception { FindDisk.file(); }

private static void file() throws Exception
{
    Sigar sigar = new Sigar();
    FileSystem fslist[] = sigar.getFileSystemList();
    for (int i = 0; i < fslist.length; i++)
    {
        System.out.println("\n~~~~~~~~~~~~~" + i + "~~~~~~~~~~~~~~");
        FileSystem fs = fslist[i];
        System.out.println(fs.getDevName());
        System.out.println(fs.getDirName());
        System.out.println(fs.getFlags());//
        System.out.println(fs.getSysTypeName());
        System.out.println(fs.getTypeName());
        System.out.println(fs.getType());
    }
    return;
}

}

use my java code , I can get C:, D:, E:, F:, G:, W:, BUG no I: