DarrenF 最近的时间轴更新
DarrenF

DarrenF

V2EX 第 389061 号会员,加入于 2019-03-04 12:07:08 +08:00
DarrenF 最近回复了
2019-03-05 14:33:12 +08:00
回复了 TomKate 创建的主题 Java 如何通过 Java 获取远端服务器剩余磁盘大小?
@dark3212 这个我试过 挂载出来好像不行,Java 依然只能读取本地磁盘,用 File ("\\网络路径文件夹")可以读取到网络路径文件所在磁盘剩余大小:
File win = new File("\\\\192.xxx.xxx.xxx\\share");
System.out.println(win.getPath());
System.out.println(win.getName());
System.out.println("Free space = " + (win.getFreeSpace() / (1024 * 1024)) / 1024 + "G");
// 显示 GB 大小
System.out.println("Free space = " + win.getFreeSpace());
System.out.println("Usable space = " + win.getUsableSpace());
System.out.println("Total space = " + win.getTotalSpace());
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2867 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 11ms · UTC 11:39 · PVG 19:39 · LAX 04:39 · JFK 07:39
Developed with CodeLauncher
♥ Do have faith in what you're doing.