getAvailableDiskSpace

Returns the available disk space based on a given path. On Windows, path must be a directory; on POSIX systems, it can be a file or directory.

@safe
ulong
getAvailableDiskSpace
(
scope const(char)[] path
)

Parameters

path const(char)[]

on Windows, it must be a directory; on POSIX it can be a file or directory

Return Value

Type: ulong

Available space in bytes

Throws

FileException in case of failure

Examples

import std.exception : assertThrown;

auto space = getAvailableDiskSpace(".");
assert(space > 0);

assertThrown!FileException(getAvailableDiskSpace("ThisFileDoesNotExist123123"));

Meta