I want to determine the available disk space on windows. I don't care that my code is not portable. I use this :
String[] command = {"dir",drive};
Process process = Runtime.getRuntime().exec(command);
InputStream result = process.getInputStream();
aiming to parse the result from a "dir C:" type of call, but the String I get from the command line call is as if I called dir with a /W
option (not giving any information about file sizes or disk usage / free space). (Although when I launch dir C:
directly from the command line, I get the expected result, so there is no dir
particular setup on my system.) Trying to pass a token /-W
or on any other option seems not to work : I just get the name of the folders/files contained in the drive, but no other information whatsoever.
Someone knows a fix / workaround ?
NOTE:
I can't go along the fsutil
route, because fsutil
does not work on network drives.