The Filesystem library provides facilities for performing operations on file systems and their components, such as paths, regular files, and directories.
The filesystem library was originally developed as boost.filesystem, was published as the technical specification ISO/IEC TS 18822:2015, and finally merged to ISO C++ as of C++17. The boost implementation is currently available on more compilers and platforms than the C++17 library.
The filesystem library facilities may be unavailable if a hierarchical file system is not accessible to the implementation, or if it does not provide the necessary capabilities. Some features may not be available if they are not supported by the underlying file system (e.g. the FAT filesystem lacks symbolic links and forbids multiple hardlinks). In those cases, errors must be reported.
The behavior is undefined 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.
".."
. "."
(dot) and ".."
(dot-dot) have special meaning at library level. "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. "."
or ".."
elements. "."
(dot, "current directory") and ".."
(dot-dot, "parent directory") are relative paths. Defined in header <filesystem> |
|
---|---|
Defined in namespace filesystem |
|
(C++17) | represents a path (class) |
(C++17) | an exception thrown on file system errors (class) |
(C++17) | a directory entry (class) |
(C++17) | an iterator to the contents of the directory (class) |
(C++17) | an iterator to the contents of a directory and its subdirectories (class) |
(C++17) | represents file type and permissions (class) |
(C++17) | information about free and available space on the filesystem (class) |
(C++17) | the type of a file (enum) |
(C++17) | identifies file system permissions (enum) |
(C++17) | specifies semantics of permissions operations (enum) |
(C++17) | specifies semantics of copy operations (enum) |
(C++17) | options for iterating directory contents (enum) |
(C++17) | represents file time values (typedef) |
(C++17) | composes an absolute path (function) |
(C++17) | composes a canonical path (function) |
(C++17) | composes a relative path (function) |
(C++17) | copies files or directories (function) |
(C++17) | copies file contents (function) |
(C++17) | copies a symbolic link (function) |
(C++17)(C++17) | creates new directory (function) |
(C++17) | creates a hard link (function) |
(C++17)(C++17) | creates a symbolic link (function) |
(C++17) | returns or sets the current working directory (function) |
(C++17) | checks whether path refers to existing file system object (function) |
(C++17) | checks whether two paths refer to the same file system object (function) |
(C++17) | returns the size of a file (function) |
(C++17) | returns the number of hard links referring to the specific file (function) |
(C++17) | gets or sets the time of the last data modification (function) |
(C++17) | modifies file access permissions (function) |
(C++17) | obtains the target of a symbolic link (function) |
(C++17)(C++17) | removes a file or empty directory removes a file or directory and all its contents, recursively (function) |
(C++17) | moves or renames a file or directory (function) |
(C++17) | changes the size of a regular file by truncation or zero-fill (function) |
(C++17) | determines available free space on the file system (function) |
(C++17)(C++17) | determines file attributes determines file attributes, checking the symlink target (function) |
(C++17) | returns a directory suitable for temporary files (function) |
File types |
|
(C++17) | checks whether the given path refers to block device (function) |
(C++17) | checks whether the given path refers to a character device (function) |
(C++17) | checks whether the given path refers to a directory (function) |
(C++17) | checks whether the given path refers to an empty file or directory (function) |
(C++17) | checks whether the given path refers to a named pipe (function) |
(C++17) | checks whether the argument refers to an other file (function) |
(C++17) | checks whether the argument refers to a regular file (function) |
(C++17) | checks whether the argument refers to a named IPC socket (function) |
(C++17) | checks whether the argument refers to a symbolic link (function) |
(C++17) | checks whether file status is known (function) |
Using this library may require additional compiler/linker options. GNU implementation requires linking with -lstdc++fs
and LLVM implementation requires linking with -lc++fs
.
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/filesystem