PHP
SPL/Iterators

RecursiveDirectoryIterator (class)

The RecursiveDirectoryIterator class

Introduction

(PHP 5, PHP 7)

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

Class synopsis

RecursiveDirectoryIterator extends FilesystemIterator implements SeekableIterator , RecursiveIterator {

/* Methods */

public __construct ( string $path [, int $flags = FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO ] )

public mixed getChildren ( void )

public string getSubPath ( void )

public string getSubPathname ( void )

public bool hasChildren ([ bool $allow_links = false ] )

public string key ( void )

public void next ( void )

public void rewind ( void )

/* Inherits */

public FilesystemIterator::__construct ( string $path [, int $flags = FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::SKIP_DOTS ] )

public mixed FilesystemIterator::current ( void )

public int FilesystemIterator::getFlags ( void )

public string FilesystemIterator::key ( void )

public void FilesystemIterator::next ( void )

public void FilesystemIterator::rewind ( void )

public void FilesystemIterator::setFlags ([ int $flags ] )

}

Changelog

VersionDescription
5.3.0The FilesystemIterator was introduced as the parent class. Previously, the parent was the DirectoryIterator.
5.3.0Implements SeekableIterator.
5.2.11, 5.3.1Added RecursiveDirectoryIterator::FOLLOW_SYMLINKS

Table of Contents

  • RecursiveDirectoryIterator::__construct — Constructs a RecursiveDirectoryIterator

  • RecursiveDirectoryIterator::getChildren — Returns an iterator for the current entry if it is a directory

  • RecursiveDirectoryIterator::getSubPath — Get sub path

  • RecursiveDirectoryIterator::getSubPathname — Get sub path and name

  • RecursiveDirectoryIterator::hasChildren — Returns whether current entry is a directory and not '.' or '..'

  • RecursiveDirectoryIterator::key — Return path and filename of current dir entry

  • RecursiveDirectoryIterator::rewind — Rewind dir back to the start

← RecursiveCallbackFilterIterator::hasChildren

RecursiveDirectoryIterator::__construct →

© 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

https://secure.php.net/manual/en/class.recursivedirectoryiterator.php