Boost FileSystem

The Boost FileSystem is a library part of the Boost. It gives portable access to many common file system functions that aren't in the C++ standard. The Boost FileSystem is not written for easy access to absolute paths, and its documentation discourages the use of them.

Functions

  • bool is_directory(path& x)
  • bool exists(path& x)
  • bool symbolic_link_exists(path& x)
  • bool is_empty(path& x)
  • bool _is_empty(path& x) - alternate function used in the case when is_empty conflicts with a separate is_empty function.
  • bool equivalent(path& x, path& y) - if two path names RESOLVE to the same entity (for example, in some file systems "abc" is not the same file as "ABC", but in some file systems they are equivalent.
  • intmax_t file_size(path& x) - returns the file size in bytes
  • time_t last_write_time(path& x ) - returns the "last modified" time
  • void last_write_time(path& x, time_t new_time ) - puts the "last modified" time in new_time
  • path current_path()
  • path& initial_path()
  • path system_complete(path& x)
  • path complete(path& x, path& base = initial_path() )
Operations:
  • bool create_directory(path& x ) - CREATES a directory with the name of path x
  • bool remove(path& x)
  • unsigned long remove_all(path& x)
  • void rename(path& old_path, path& new_path )
  • void copy_file(path& source, path& destination)

Classes

path

Methods

  • bool name_check(string& name)
Decomposition functions:
  • path root_path()
  • string root_name()
  • string root_directory()
  • path relative_path()
  • string leaf()
  • path branch_path()
  • string native_file_string()
  • string native_directory_string()
Query functions:
  • bool empty()
  • bool is_complete()
  • bool has_root_path()
  • bool has_root_name()
  • bool has_root_directory()
  • bool has_relative_path()
  • bool has_leaf()
  • bool has_branch_path()

directory_iterator

A directory iterator must be used to see the files and folders inside the directory.

Constructors

  • directory_iterator(path p)