g. the FAT filesystem lacks
symbolic links and forbids multiple hardlinks). In those cases, errors must be
reported.

The behavior is [ undefined ](/w/cpp/language/ub "cpp/language/ub") if the
calls to functions in this library introduce a _file system race_ , that is,
when multiple threads, processes, or computers interleave access and
modification to the same object in a file system.

##  Contents

  * 1  Library-wide definitions 
  * 2  Classes 
  * 3  Non-member functions 
    * 3.1  File types 
  * 4  Notes 
  * 5  See also 

  
---  
  
####  [ [ edit ](/mwiki/index.php?title=cpp/filesystem&action=edit&section=1
"Edit section: Library-wide definitions") ]  Library-wide definitions

  * _file_ : a file system object that holds data, can be written to, read from, or both. Files have names, attributes, one of which is file type: 

    

  * _directory_ : a file that acts as a container of directory entries, which identify other files (some of which may be other, nested directories). When discussing a particular file, the directory in which it appears as an entry is its _parent directory_ . The parent directory can be represented by the relative pathname  ".."  . 
  * _regular file_ : a directory entry that associates a name with an existing file (i.e. a _hard link_ ). If multiple hard links are supported, the file is removed after the last hard link to it is removed. 
  * _symbolic link_ : a directory entry that associates a name with a path, which may or may not exist. 
  * other special file types: _block_ , _character_ , _fifo_ , _socket_ . 

  * _file name_ : a string of characters that names a file. Permissible characters, case sensitivity, maximum length, and the disallowed names are implementation-defined. Names  "."  (dot) and  ".."  (dot-dot) have special meaning at library level. 
  * _path_ : sequence of elements that identifies a file. It begins with an optional  root-name  (e.g.  "C:"  or  "//server"  on Windows), followed by an optional  root-directory  (e.g.  "/"  on Unix), followed by a sequence of zero or more file names (all but last of which have to be directories or links to directories). The native format (e.g. which characters are used as separators) and character encoding of the string representation of a path (the _pathname_ ) is implementation-defined, this library provides portable representation of paths. 

    

  * _absolute path_ : a path that unambiguously identifies the location of a file. 
  * _canonical path_ : an absolute path that includes no symlinks,  "."  or  ".."  elements. 
  * _relative path_ : a path that identifies the location of a file relative to some location on the file system. The special path names  "."  (dot, "current directory") and  ".."  (dot-dot, "parent directory") are relative paths. 

###  Classes  
  
---  
Defined in header ` [ <filesystem> ](/w/cpp/header/filesystem
"cpp/header/filesystem") `  
Defined in namespace ` std::filesystem `  
[ path  ](/w/cpp/filesystem/path "cpp/filesystem/path") (C++17)  |  represents a path   
(class)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/filesystem/dsc_path&action=edit)  
[ filesystem_error  ](/w/cpp/filesystem/filesystem_error "cpp/filesystem/filesystem error") (C++17)  |  an exception thrown on file system errors   
(class)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/filesystem/dsc_filesystem_error&action=edit)  
[ directory_entry  ](/w/cpp/filesystem/directory_entry "cpp/filesystem/directory entry") (C++17)  |  a directory entry   
(class)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/filesystem/dsc_directory_entry&action=edit)  
[ directory_iterator  ](/w/cpp/filesystem/directory_iterator "cpp/filesystem/directory iterator") (C++17)  |  an iterator to the contents of the directory   
(class)  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/filesystem/dsc_directory_iterator&action=edit)  
[ recursive_directo