package com.zuidaima.util.file;
 
import java.io.File;
 
public class FreeDiskSpace {
 
    public static void main(String[] args) {
        File file = new File("c:");
        long totalSpace = file.getTotalSpace();
        long freeSpace = file.getFreeSpace();
        long usedSpace = totalSpace - freeSpace;
 
        System.out.println("总空间大小 : " + totalSpace / 1024 / 1024 / 1024 + "G");
        System.out.println("剩余空间大小 : " + freeSpace / 1024 / 1024 / 1024 + "G");
        System.out.println("已用空间大小 : " + usedSpace / 1024 / 1024 / 1024 + "G");
    }
 
}

 

相关文章:

  • 2021-11-21
  • 2021-07-13
  • 2021-11-20
  • 2022-01-30
  • 2022-12-23
  • 2021-08-10
  • 2022-01-09
猜你喜欢
  • 2022-02-05
  • 2021-12-20
  • 2022-12-23
  • 2021-07-03
  • 2021-07-26
  • 2021-12-19
  • 2022-12-23
相关资源
相似解决方案