filesystem
#include <filesystem>
#include <iostream>
using namespace std;
int main()
{
//打开文件夹
filesystem::path url("file");
//判断当前文件夹是否存在
if (!filesystem::exists(url))
{
cout << "相对路径文件夹不存在" << endl;
}
//创建单层文件夹,路径存在不做其他操作
filesystem::create_directory("file");
//存储错误信息
error_code err;
//将文件夹是否创建成功的信息存入
filesystem::create_directory("file/x", err);
//将存储的错误信息打印出来
cout << err.message() << endl;
//创建多层文件夹
filesystem::create_directories("sss/ss/s", err);
cout << err.message() << endl;
//删除根文件夹
filesystem::remove_all(url);
//获取文件最后一次的操作时间
auto time = filesystem::last_write_time("sss");
//获取时间戳
cout << time.time_since_epoch().count() << endl;
//获取当前路径
filesystem::path CUR = filesystem::current_path();
cout << CUR<< endl;
cout << CUR.root_directory() << endl;//根目录
cout <<