#include #include // Required for std::filesystem #include using namespace std ; namespace fs = std::filesystem ; int main() { fs::path target_path = "." ; fs::space_info si = fs::space( target_path ) ; // Convert bytes to Gigabytes (1 GB = 1024^3 bytes) const double GB = 1024.0 * 1024.0 * 1024.0 ; std::cout << "Filesystem Info for: " << fs::absolute(target_path) << "\n" ; std::cout << "---------------------------------------------\n" ; std::cout << "Total Capacity: " << (si.capacity / GB) << " GB\n" ; std::cout << "Free Space: " << (si.free / GB) << " GB\n" ; std::cout << "Available Space: " << (si.available / GB) << " GB\n" ; fs::path dir_path = "my_folder"; try { // 2. Create the folders if they don't exist // create_directories() automatically builds any missing parent folders if (fs::create_directories(dir_path)) { std::cout << "Success: Folders created at " << dir_path << "\n"; } else { std::cout << "Info: Folders already exist or no new directories were made.\n"; } } catch (const fs::filesystem_error& e) { // Handle operating system/permission level errors gracefully std::cerr << "Filesystem error: " << e.what() << "\n"; } //cout << "Filesystem size:" << //std::filesystem::file_size("") ; /* const auto bigFilePath {"bigFileToCopy"} ; if (std::filesystem::exists(bigFilePath)) { const auto bigFileSize {std::filesystem::file_size(bigFilePath)}; std::filesystem::path tmpPath {"/tmp"}; if (std::filesystem::space(tmpPath).available > bigFileSize) { std::filesystem::create_directory(tmpPath.append("example")); std::filesystem::copy_file(bigFilePath, tmpPath.append("newFile")); } */ return 1 ; }