std::experimental::filesystem::space
Min standard notice:
Header: <experimental/filesystem>
Determines the information about the filesystem on which the pathname p is located, as if by POSIX statvfs.
# Declarations
space_info space( const path& p );
space_info space( const path& p, error_code& ec ) noexcept;
(filesystem TS)
# Parameters
p: path to examineec: out-parameter for error reporting in the non-throwing overload
# Return value
The filesystem information (a space_info object).
# Notes
space_info.available may be less than space_info.free.
# Example
#include <experimental/filesystem>
#include <iostream>
namespace fs = std::experimental::filesystem;
int main()
{
fs::space_info devi = fs::space("/dev/null");
fs::space_info tmpi = fs::space("/tmp");
std::cout << " Capacity Free Available\n"
<< "/dev: " << devi.capacity << " "
<< devi.free << " " << devi.available << '\n'
<< "/tmp: " << tmpi.capacity << ' '
<< tmpi.free << ' ' << tmpi.available << '\n';
}