다음을 통해 공유


<filesystem>

Include the header <filesystem> to define classes and functions for the manipulation of files and directories.

#include <filesystem>

Warning

The <filesystem> header is not a C++ standard, although it is being proposed for standardization. If it is adopted as a standard, we will investigate the impact on the interface.

Typedefs

Name

Description

path

basic_path<string, path_traits>

wpath

basic_path<wstring, wpath_traits>

filesystem_error

basic_filesystem_error<path>

wfilesystem_error

basic_filesystem_error<wpath>

directory_entry

basic_directory_entry<path>

wdirectory_entry

basic_directory_entry<wpath>

directory_iterator

basic_directory_iterator<path>

wdirectory_iterator

basic_directory_iterator<wpath>

recursive_directory_iterator

basic_recursive_directory_iterator<path>

wrecursive_directory_iterator

basic_recursive_directory_iterator<wpath>

Classes

Name

Description

basic_directory_entry Class

Describes an object that is returned by *X, where X is a basic_directory_iterator or a basic_recursive_directory_iterator.

basic_directory_iterator Class

Describes an input iterator that sequences through the file names in a file-system directory.

basic_filesystem_error Class

A base class for exceptions that are thrown to report a low-level system overflow.

basic_path Class

Defines a class that stores an object of template type String that is suitable for use as a file name.

basic_recursive_directory_iterator Class

Describes an input iterator that sequences through the file names in a file-system directory. The iterator can also descend into subdirectories.

file_status Class

Wraps a file_type.

Structs

Name

Description

colon Structure

Defines a struct that has a static data member that represents a colon character.

dot Structure

Defines a struct that has a static data member that represents a dot character.

is_basic_path Structure

Specifies whether a type is suitable for use as a Path parameter for other templates that are defined in the <filesystem> header.

path_traits Structure

Describes properties for the specialization basic_path<string, path_traits>.

slash Structure

Defines a struct that has a static data member that represents a slash character.

space_info Structure

Holds information about a volume.

wpath_traits Structure

Describes properties for the specialization basic_path<wstring, wpath_traits>.

Functions

Name

Description

basename Function

Returns the stem of a specified path.

complete Function

Creates a full path from specified Path values, if possible.

copy_file Function

Copies the attributes and contents in one file and pastes them in another.

create_directories Function

Creates a directory from a specified file name. Also creates intermediate directories as required.

create_directory Function

Creates a directory from a specified file name.

create_hard_link Function

Creates a hard link to an existing file.

create_symlink Function

Creates a symbolic link to an existing file.

current_path Function

Sets or retrieves the current working directory.

equivalent Function

Specifies whether two file names reference the same file.

exists Function

Specifies whether a file exists.

extension Function

Retrieves the file name extension of a specified file.

file_size Function

Returns the size, in bytes, of a file that has a specified name.

initial_path Function

Returns the current working directory at program startup.

is_directory Function

Indicates whether the specified file_status or file name represents a directory.

is_empty Function

Indicates whether a specified path refers to an empty file or directory.

is_other Function

Indicates whether the specified file_status or file name represents an existing file that is not a file, a directory, or a symbolic link.

is_regular Function

Indicates whether the specified file_status or file name represents a file.

is_regular_file Function

Indicates whether the specified file_status or file name represents a file.

is_symlink Function

Indicates whether the specified file_status or file name represents a symbolic link.

last_write_time Function

Determines the last write time for a specified file.

remove Function

Removes a file that has the specified path.

remove_all Function

Removes a file or directory that has the specified path.

remove_directory Function

Removes a directory that has the specified path.

remove_filename Function

Removes a file that has the specified path.

rename Function

Renames an existing file.

replace_extension Function

Replaces the file name extension of the specified file.

space Function

Retrieves information about a specified volume.

status Function

Retrieves the status of the specified file.

status_known Function

Specifies whether a given file status is known.

stem Function

Returns the stem of the specified path.

swap Function (STL)

Exchanges the stored file names of two basic_path objects.

symlink_status Function

Retrieves the symbolic link status of a specified file.

system_complete Function

Converts a given file name to a complete file name, if possible.

Operators

Name

Description

operator!= (STL)

Inequality operator that is used with basic_path, basic_directory_iterator, and basic_recursive_directory_iterator objects.

operator== (STL)

Equality operator that is used with basic_path, basic_directory_iterator, and basic_recursive_directory_iterator objects.

operator<< Operator

Writes the stored path of the specified object to a stream.

operator< (STL)

Indicates whether the stored string value of one basic_path object is less than that of another basic_path object.

operator<= (STL)

Indicates whether the stored string value of one basic_path object is less than or equal to that of another basic_path object.

operator>> Operator

Extracts a string from a basic_istream and assigns it to a Path object.

operator> (STL)

Indicates whether the stored string value of one basic_path object is greater than that of another basic_path object.

operator>= (STL)

Indicates whether the stored string value of one basic_path object is greater than or equal to that of another basic_path object.

operator/ (STL)

Concatenates the stored file names of two basic_path objects.

Enumerations

Name

Description

copy_option Enumeration

An enumeration that is used with copy_file and determines behavior if a destination file already exists.

file_type Enumeration

An enumeration for file types.

See Also

Other Resources

C++ Standard Library Header Files