[fs.filesystem.syn]

# 31 Input/output library [[input.output]](./#input.output)

## 31.12 File systems [[filesystems]](filesystems#fs.filesystem.syn)

### 31.12.4 Header <filesystem> synopsis [fs.filesystem.syn]

[ð](#header:%3cfilesystem%3e)

#include <compare> // see [[compare.syn]](compare.syn "17.12.1 Header <compare> synopsis")namespace std::filesystem {// [[fs.class.path]](fs.class.path "31.12.6 Class path"), pathsclass path; // [[fs.path.nonmember]](fs.path.nonmember "31.12.6.8 Non-member functions"), path non-member functionsvoid swap(path& lhs, path& rhs) noexcept;
 size_t hash_value(const path& p) noexcept; // [[fs.class.filesystem.error]](fs.class.filesystem.error "31.12.7 Class filesystem_­error"), filesystem errorsclass filesystem_error; // [[fs.class.directory.entry]](fs.class.directory.entry "31.12.10 Class directory_­entry"), directory entriesclass directory_entry; // [[fs.class.directory.iterator]](fs.class.directory.iterator "31.12.11 Class directory_­iterator"), directory iteratorsclass directory_iterator; // [[fs.dir.itr.nonmembers]](fs.dir.itr.nonmembers "31.12.11.3 Non-member functions"), range access for directory iterators directory_iterator begin(directory_iterator iter) noexcept;
 directory_iterator end(directory_iterator) noexcept; // [[fs.class.rec.dir.itr]](fs.class.rec.dir.itr "31.12.12 Class recursive_­directory_­iterator"), recursive directory iteratorsclass recursive_directory_iterator; // [[fs.rec.dir.itr.nonmembers]](fs.rec.dir.itr.nonmembers "31.12.12.3 Non-member functions"), range access for recursive directory iterators recursive_directory_iterator begin(recursive_directory_iterator iter) noexcept;
 recursive_directory_iterator end(recursive_directory_iterator) noexcept; // [[fs.class.file.status]](fs.class.file.status "31.12.9 Class file_­status"), file statusclass file_status; struct space_info { uintmax_t capacity;
 uintmax_t free;
 uintmax_t available; friend bool operator==(const space_info&, const space_info&) = default; }; // [[fs.enum]](fs.enum "31.12.8 Enumerations"), enumerationsenum class file_type; enum class perms; enum class perm_options; enum class copy_options; enum class directory_options; using file_time_type = chrono::time_point<chrono::file_clock>; // [[fs.op.funcs]](fs.op.funcs "31.12.13 Filesystem operation functions"), filesystem operations path absolute(const path& p);
 path absolute(const path& p, error_code& ec);

 path canonical(const path& p);
 path canonical(const path& p, error_code& ec); void copy(const path& from, const path& to); void copy(const path& from, const path& to, error_code& ec); void copy(const path& from, const path& to, copy_options options); void copy(const path& from, const path& to, copy_options options,
 error_code& ec); bool copy_file(const path& from, const path& to); bool copy_file(const path& from, const path& to, error_code& ec); bool copy_file(const path& from, const path& to, copy_options option); bool copy_file(const path& from, const path& to, copy_options option,
 error_code& ec); void copy_symlink(const path& existing_symlink, const path& new_symlink); void copy_symlink(const path& existing_symlink, const path& new_symlink,
 error_code& ec) noexcept; bool create_directories(const path& p); bool create_directories(const path& p, error_code& ec); bool create_directory(const path& p); bool create_directory(const path& p, error_code& ec) noexcept; bool create_directory(const path& p, const path& attributes); bool create_directory(const path& p, const path& attributes,
 error_code& ec) noexcept; void create_directory_symlink(const path& to, const path& new_symlink); void create_directory_symlink(const path& to, const path& new_symlink,
 error_code& ec) noexcept; void create_hard_link(const path& to, const path& new_hard_link); void create_hard_link(const path& to, const path& new_hard_link,
 error_code& ec) noexcept; void create_symlink(const path& to, const path& new_symlink); void create_symlink(const path& to, const path& new_symlink,
 error_code& ec) noexcept;

 path current_path();
 path current_path(error_code& ec); void current_path(const path& p); void current_path(const path& p, error_code& ec) noexcept; bool equivalent(const path& p1, const path& p2); bool equivalent(const path& p1, const path& p2, error_code& ec) noexcept; bool exists(file_status s) noexcept; bool exists(const path& p); bool exists(const path& p, error_code& ec) noexcept;

 uintmax_t file_size(const path& p);
 uintmax_t file_size(const path& p, error_code& ec) noexcept;

 uintmax_t hard_link_count(const path& p);
 uintmax_t hard_link_count(const path& p, error_code& ec) noexcept; bool is_block_file(file_status s) noexcept; bool is_block_file(const path& p); bool is_block_file(const path& p, error_code& ec) noexcept; bool is_character_file(file_status s) noexcept; bool is_character_file(const path& p); bool is_character_file(const path& p, error_code& ec) noexcept; bool is_directory(file_status s) noexcept; bool is_directory(const path& p); bool is_directory(const path& p, error_code& ec) noexcept; bool is_empty(const path& p); bool is_empty(const path& p, error_code& ec); bool is_fifo(file_status s) noexcept; bool is_fifo(const path& p); bool is_fifo(const path& p, error_code& ec) noexcept; bool is_other(file_status s) noexcept; bool is_other(const path& p); bool is_other(const path& p, error_code& ec) noexcept; bool is_regular_file(file_status s) noexcept; bool is_regular_file(const path& p); bool is_regular_file(const path& p, error_code& ec) noexcept; bool is_socket(file_status s) noexcept; bool is_socket(const path& p); bool is_socket(const path& p, error_code& ec) noexcept; bool is_symlink(file_status s) noexcept; bool is_symlink(const path& p); bool is_symlink(const path& p, error_code& ec) noexcept;

 file_time_type last_write_time(const path& p);
 file_time_type last_write_time(const path& p, error_code& ec) noexcept; void last_write_time(const path& p, file_time_type new_time); void last_write_time(const path& p, file_time_type new_time,
 error_code& ec) noexcept; void permissions(const path& p, perms prms, perm_options opts=perm_options::replace); void permissions(const path& p, perms prms, error_code& ec) noexcept; void permissions(const path& p, perms prms, perm_options opts, error_code& ec);

 path proximate(const path& p, error_code& ec);
 path proximate(const path& p, const path& base = current_path());
 path proximate(const path& p, const path& base, error_code& ec);

 path read_symlink(const path& p);
 path read_symlink(const path& p, error_code& ec);

 path relative(const path& p, error_code& ec);
 path relative(const path& p, const path& base = current_path());
 path relative(const path& p, const path& base, error_code& ec); bool remove(const path& p); bool remove(const path& p, error_code& ec) noexcept;

 uintmax_t remove_all(const path& p);
 uintmax_t remove_all(const path& p, error_code& ec); void rename(const path& from, const path& to); void rename(const path& from, const path& to, error_code& ec) noexcept; void resize_file(const path& p, uintmax_t size); void resize_file(const path& p, uintmax_t size, error_code& ec) noexcept;

 space_info space(const path& p);
 space_info space(const path& p, error_code& ec) noexcept;

 file_status status(const path& p);
 file_status status(const path& p, error_code& ec) noexcept; bool status_known(file_status s) noexcept;

 file_status symlink_status(const path& p);
 file_status symlink_status(const path& p, error_code& ec) noexcept;

 path temp_directory_path();
 path temp_directory_path(error_code& ec);

 path weakly_canonical(const path& p);
 path weakly_canonical(const path& p, error_code& ec);}namespace std {// [[fs.path.fmtr]](fs.path.fmtr "31.12.6.9 Formatting support"), formatting supporttemplate<class charT> struct formatter<filesystem::path, charT>; // [[fs.path.hash]](fs.path.hash "31.12.6.10 Hash support"), hash supporttemplate<class T> struct hash; template<> struct hash<filesystem::path>;}namespace std::ranges {template<>inline constexpr bool enable_borrowed_range<filesystem::directory_iterator> = true; template<>inline constexpr bool enable_borrowed_range<filesystem::recursive_directory_iterator> = true; template<>inline constexpr bool enable_view<filesystem::directory_iterator> = true; template<>inline constexpr bool enable_view<filesystem::recursive_directory_iterator> = true;}

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L13494)

Implementations should ensure that the resolution and range offile_time_type reflect the operating system dependent resolution and range
of file time values[.](#1.sentence-1)
