i tried code:
try { process p = runtime.getruntime().exec("df -t"); bufferedreader in = new bufferedreader(new inputstreamreader(p.getinputstream())); string line = null; while ((line = in.readline()) != null) { string[] values = line.split(" "); (string str : values) { system.out.println(str); if (str.equals("ntfs")){ system.out.println("ntfs"); } } //system.out.println(line); } in.close(); } catch (ioexception e) { e.printstacktrace(); } but isn write ntfs , how can work fine? or have use other command? want check filesystem use. df -t:
filesystem 1k-blocks used available use% mounted on /dev/mapper/centos_vjanurik-root 52403200 42261280 10141920 81% / devtmpfs 3894660 0 3894660 0% /dev tmpfs 3904524 4892 3899632 1% /dev/shm tmpfs 3904524 9168 3895356 1% /run tmpfs 3904524 0 3904524 0% /sys/fs/cgroup /dev/mapper/centos_vjanurik-home 56235184 29428876 26806308 53% /home /dev/sda1 508588 107384 401204 22% /boot
on system df -t outputs file system type in lowercase. comparing against "ntfs" .... uppercase.
also, output have shown doesn't appear output regular linux df -t ... because doesn't have type column.
Comments
Post a Comment