// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.io.IOException;
import java.lang.reflect.Field;
import java.nio.file.Files;
import java.nio.file.Paths;

public class StorageDetails {
    public static void dump(String indent, Object o) throws IllegalArgumentException, IllegalAccessException {
        for(Field f : o.getClass().getDeclaredFields()) {
            System.out.print(indent + f.getName() + " : " + f.getType().getName());
            f.setAccessible(true);
            Object o2 = f.get(o);
            if(o2.getClass().getPackage().getName().startsWith("java.lang")) {
                System.out.println(" = " + o2);
            } else {
                System.out.println();
                dump(indent + "  ", o2);
            }
        }
    }
    public static void fsdump(String pathstr) throws IOException, IllegalArgumentException, IllegalAccessException {
        dump("", Files.getFileStore(Paths.get(pathstr)));
    }
    public static void main(String[] args) throws Exception {
        fsdump("C:\\");
    }
}
