Search Results

  1. The RecursiveDirectoryIterator class Introduction ¶ The RecursiveDirectoryIterator provides an interface for iterating recursively over filesystem directories.

    • In this article
    • Remarks
    • recursive_directory_iterator::depth
    • recursive_directory_iterator::increment
    • recursive_directory_iterator::operator!=
    • recursive_directory_iterator::operator=
    • recursive_directory_iterator::operator==
    • recursive_directory_iterator::operator*
    • recursive_directory_iterator::operator-
    • recursive_directory_iterator::operator++

    Describes an input iterator that sequences through the filenames in a directory, possibly descending into subdirectories recursively. For an iterator X, the expression *X evaluates to an object of class directory_entry that wraps the filename and anything known about its status.

    For more information and code examples, see

    an object of type stack >, called mystack here for the purposes of exposition, which represents the nest of directories to be sequenced

    an object of type directory_entry called myentry here, which represents the current filename in the directory sequence

    , called no_push here, which records whether recursive descent into subdirectories is disabled

    an object of type directory_options, called myoptions here, which records the options established at construction

    A default constructed object of type recursive_directory_entry has an end-of-sequence iterator at mystack.top ().first and represents the end-of-sequence iterator. For example, given the directory abc with entries def (a directory), def/ghi, and jkl, the code:

    will call visit with the arguments path ("abc/def/ghi") and path ("abc/jkl"). You can qualify sequencing through a directory subtree in two ways:

    Returns mystack.size () - 1, so pval is at depth zero.

    Advances to the next filename in sequence.

    recursive_directory_iterator& increment(error_code& ec) noexcept;

    Returns ! (*this == right).

    bool operator!=(const recursive_directory_iterator& right) const;

    The defaulted member assignment operators behave as expected.

    recursive_directory_iterator& operator=(const recursive_directory_iterator&) = default;

    recursive_directory_iterator& operator=(recursive_directory_iterator&&) noexcept = default;

    being copied into the recursive_directory_iterator.

    are end-of-sequence iterators or both aren't end-of-sequence-iterators.

    bool operator==(const recursive_directory_iterator& right) const;

    const directory_entry& operator*() const;

    const directory_entry * operator->() const;

    The first member function calls increment (), then returns

    The second member function makes a copy of the object, calls increment (), then returns the copy.

  2. These specializations for recursive_directory_iterator make it a borrowed_range and a view. Notes A recursive_directory_iterator typically holds a reference-counted pointer (to satisfy shallow-copy semantics of LegacyInputIterator) to an implementation object, which holds: a container (such as std::vector) of non-recursive directory_iterator s that forms the recursion stack, the recursion ...

  3. RecursiveDirectoryIterator::getChildren — Returns an iterator for the current entry if it is a directory RecursiveDirectoryIterator::hasChildren — Returns whether current entry is a directory and not '.' or '..' RecursiveDirectoryIterator::key — Return path and filename of current dir entry RecursiveDirectoryIterator::next — Move to ...

  4. Introduction The RecursiveDirectoryIterator provides an interface for iterating recursively over filesystem directories.

  5. Introduction The RecursiveDirectoryIterator provides an interface for iterating recursively over filesystem directories.

  6. People also ask

  7. Introduction The RecursiveDirectoryIterator provides an interface for iterating recursively over filesystem directories.

  1. People also search for