On Wednesday, 14 February 2018 at 12:29:13 UTC, rikki cattermole wrote:
On 14/02/2018 12:22 PM, Vino wrote:
Hi All,

 Request your help on how to get the disk space used and free size of a Network share folder in Windows, tried with getSize but it return 0;

eg: Share Name :\\server1\dir1$

From,
Vino.B

See:

https://msdn.microsoft.com/en-us/library/windows/desktop/aa364935(v=vs.85).aspx

Hi Rikki,

Wouldn't this be easy to use with std.process: execute package and calling wmic.exe, the only problem is i am not sure hot to get the out put without the headings(Caption FreeSpace,Size) any help on same is much appreciated.

import std.process: execute;
import std.stdio : writeln;

void main () {
version(Windows) {
auto result = execute(["wmic.exe", "logicaldisk", "get", "size,freespace,caption"]);
writeln(result.output);
}
}
Output :
Caption  FreeSpace    Size
C:       19702837248  180043665408
H:       85580382208  824633720832

From,
Vino.B

Reply via email to