# RecursiveDirectoryIterator クラス

(PHP 5, PHP 7, PHP 8)

## はじめに

RecursiveDirectoryIterator は、 ファイルシステムのディレクトリを再帰的に反復処理するためのインターフェイスです。

## クラス概要

class RecursiveDirectoryIterator extends FilesystemIterator implements RecursiveIterator {
/* 継承した定数 */
public const int FilesystemIterator::CURRENT_MODE_MASK;
public const int FilesystemIterator::CURRENT_AS_PATHNAME;
public const int FilesystemIterator::CURRENT_AS_FILEINFO;
public const int FilesystemIterator::CURRENT_AS_SELF;
public const int FilesystemIterator::KEY_MODE_MASK;
public const int FilesystemIterator::KEY_AS_PATHNAME;
public const int FilesystemIterator::FOLLOW_SYMLINKS;
public const int FilesystemIterator::KEY_AS_FILENAME;
public const int FilesystemIterator::NEW_CURRENT_AND_KEY;
public const int FilesystemIterator::OTHER_MODE_MASK;
public const int FilesystemIterator::SKIP_DOTS;
public const int FilesystemIterator::UNIX_PATHS;
/* メソッド */
public function __construct(string `$directory`, int `$flags` = FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO)
public function getChildren(): RecursiveDirectoryIterator
public function getSubPath(): string
public function getSubPathname(): string
public function hasChildren(bool `$allowLinks` = `false`): bool
public function key(): string
public function next(): void
public function rewind(): void
/* 継承したメソッド */
public function FilesystemIterator::current(): string|SplFileInfo|FilesystemIterator
public function FilesystemIterator::getFlags(): int
public function FilesystemIterator::key(): string
public function FilesystemIterator::next(): void
public function FilesystemIterator::rewind(): void
public function FilesystemIterator::setFlags(int `$flags`): void
public function DirectoryIterator::current(): mixed
public function DirectoryIterator::getBasename(string `$suffix` = ""): string
public function DirectoryIterator::getExtension(): string
public function DirectoryIterator::getFilename(): string
public function DirectoryIterator::isDot(): bool
public function DirectoryIterator::key(): mixed
public function DirectoryIterator::next(): void
public function DirectoryIterator::rewind(): void
public function DirectoryIterator::seek(int `$offset`): void
public function DirectoryIterator::__toString(): string
public function DirectoryIterator::valid(): bool
public function SplFileInfo::getATime(): int|false
public function SplFileInfo::getBasename(string `$suffix` = ""): string
public function SplFileInfo::getCTime(): int|false
public function SplFileInfo::getExtension(): string
public function SplFileInfo::getFileInfo(?string `$class` = `null`): SplFileInfo
public function SplFileInfo::getFilename(): string
public function SplFileInfo::getGroup(): int|false
public function SplFileInfo::getInode(): int|false
public function SplFileInfo::getLinkTarget(): string|false
public function SplFileInfo::getMTime(): int|false
public function SplFileInfo::getOwner(): int|false
public function SplFileInfo::getPath(): string
public function SplFileInfo::getPathInfo(?string `$class` = `null`): ?SplFileInfo
public function SplFileInfo::getPathname(): string
public function SplFileInfo::getPerms(): int|false
public function SplFileInfo::getRealPath(): string|false
public function SplFileInfo::getSize(): int|false
public function SplFileInfo::getType(): string|false
public function SplFileInfo::isDir(): bool
public function SplFileInfo::isExecutable(): bool
public function SplFileInfo::isFile(): bool
public function SplFileInfo::isLink(): bool
public function SplFileInfo::isReadable(): bool
public function SplFileInfo::isWritable(): bool
public function SplFileInfo::openFile(string `$mode` = "r", bool `$useIncludePath` = `false`, ?resource `$context` = `null`): SplFileObject
public function SplFileInfo::setFileClass(string `$class` = `SplFileObject::class`): void
public function SplFileInfo::setInfoClass(string `$class` = `SplFileInfo::class`): void
public function SplFileInfo::__toString(): string
}

## 目次

- RecursiveDirectoryIterator::__construct — RecursiveDirectoryIterator を作成する
- RecursiveDirectoryIterator::getChildren — ディレクトリであれば、現在のエントリに対するイテレータを返す
- RecursiveDirectoryIterator::getSubPath — サブパスを取得する
- RecursiveDirectoryIterator::getSubPathname — サブパスと名前を取得する
- RecursiveDirectoryIterator::hasChildren — 現在のエントリがディレクトリかつ '.' もしくは '..' でないかどうかを返す
- RecursiveDirectoryIterator::key — 現在のディレクトリエントリのパスとファイル名を返す
- RecursiveDirectoryIterator::next — 次のエントリに移動する
- RecursiveDirectoryIterator::rewind — ディレクトリを最初に巻き戻す

`↑` and `↓` to navigate • `Enter` to select • `Esc` to close • `/` to open