Filesystem library - cppreference.com (original) (raw)

Merged into ISO C++ The functionality described on this page was merged into the mainline ISO C++ standard as of 3/2016; see the filesystem library (since C++17)

The Filesystem library, ISO/IEC TS 18822:2015, provides facilities for performing operations on file systems and their components, such as paths, regular files, and directories.

This library is an optional technical specification and 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. FAT filesystem has no hardlinks, softlinks, and other features).

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.

This library is directly based on boost.filesystem, which is currently available on more compilers and platforms than this experimental technical specification.

Contents

[edit] Library-wide definitions

[edit] Classes

path represents a path (class) [edit]
filesystem_error an exception thrown on file system errors (class) [edit]
directory_entry a directory entry (class) [edit]
directory_iterator an iterator to the contents of the directory (class) [edit]
recursive_directory_iterator an iterator to the contents of a directory and its subdirectories (class) [edit]
file_status represents file type and permissions (class) [edit]
space_info information about free and available space on the filesystem (class) [edit]
file_type the type of a file (enum) [edit]
perms identifies file system permissions (enum) [edit]
copy_options specifies semantics of copy operations (enum) [edit]
directory_options options for iterating directory contents (enum) [edit]
file_time_type represents file time values (typedef) [edit]

[edit] Non-member functions

absolutesystem_complete composes an absolute pathconverts a path to an absolute path replicating OS-specific behavior (function) [edit]
canonical composes a canonical path (function) [edit]
copy copies files or directories (function) [edit]
copy_file copies file contents (function) [edit]
copy_symlink copies a symbolic link (function) [edit]
create_directorycreate_directories creates new directory (function) [edit]
create_hard_link creates a hard link (function) [edit]
create_symlinkcreate_directory_symlink creates a symbolic link (function) [edit]
current_path return current working directory (function) [edit]
exists checks whether path refers to existing file system object (function) [edit]
equivalent checks whether two paths refer to the same file system object (function) [edit]
file_size returns the size of a file (function) [edit]
hard_link_count returns the number of hard links referring to the specific file (function) [edit]
last_write_time gets or sets the time of the last data modification (function) [edit]
permissions modifies file access permissions (function) [edit]
read_symlink obtains the target of a symbolic link (function) [edit]
removeremove_all removes a file or empty directoryremoves a file or directory and all its contents, recursively (function) [edit]
rename moves or renames a file or directory (function) [edit]
resize_file changes the size of a regular file by truncation or zero-fill (function) [edit]
space determines available free space on the file system (function) [edit]
statussymlink_status determines file attributesdetermines file attributes, checking the symlink target (function) [edit]
temp_directory_path returns a directory suitable for temporary files (function) [edit]
File types
is_block_file checks whether the given path refers to block device (function) [edit]
is_character_file checks whether the given path refers to a character device (function) [edit]
is_directory checks whether the given path refers to a directory (function) [edit]
is_empty checks whether the given path refers to an empty file or directory (function) [edit]
is_fifo checks whether the given path refers to a named pipe (function) [edit]
is_other checks whether the argument refers to an other file (function) [edit]
is_regular_file checks whether the argument refers to a regular file (function) [edit]
is_socket checks whether the argument refers to a named IPC socket (function) [edit]
is_symlink checks whether the argument refers to a symbolic link (function) [edit]
status_known checks whether file status is known (function) [edit]

[edit] See also