View source code
Display the source code in std/file.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Function std.file.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.

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

Parameters

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

Returns

Available space in bytes

Throws

FileException in case of failure

Example

import std.exception : assertThrown;

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

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

Authors

Walter Bright, Andrei Alexandrescu, Jonathan M Davis

License

Boost License 1.0.