View source code
Display the source code in std/file.d from which thispage was generated on github.
Report a bug
If you spot a problem with this page, click here to create aBugzilla 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 usinglocal 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
Name | Description |
---|---|
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
License
Copyright © 1999-2025 by the D Language Foundation | Page generated by ddox.