# La clase FilesystemIterator

(PHP 5 >= 5.3.0, PHP 7, PHP 8)

## Introducción

El iterador FilesystemIterator.

## Sinopsis de la Clase

class FilesystemIterator extends DirectoryIterator {
/* Constantes */
public const int CURRENT_MODE_MASK;
public const int CURRENT_AS_PATHNAME;
public const int CURRENT_AS_FILEINFO;
public const int CURRENT_AS_SELF;
public const int KEY_MODE_MASK;
public const int KEY_AS_PATHNAME;
public const int FOLLOW_SYMLINKS;
public const int KEY_AS_FILENAME;
public const int NEW_CURRENT_AND_KEY;
public const int OTHER_MODE_MASK;
public const int SKIP_DOTS;
public const int UNIX_PATHS;
/* Métodos */
public function __construct(string `$directory`, int `$flags` = FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::SKIP_DOTS)
public function current(): string|SplFileInfo|FilesystemIterator
public function getFlags(): int
public function key(): string
public function next(): void
public function rewind(): void
public function setFlags(int `$flags`): void
/* Métodos heredados */
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
}

## Constantes predefinidas

`FilesystemIterator::CURRENT_AS_PATHNAME`

  FilesystemIterator::current() devuelve el nombre del camino.

`FilesystemIterator::CURRENT_AS_FILEINFO`

  FilesystemIterator::current() devuelve un objeto SplFileInfo.

`FilesystemIterator::CURRENT_AS_SELF`

  FilesystemIterator::current() devuelve `$this` (el FilesystemIterator).

`FilesystemIterator::CURRENT_MODE_MASK`

  Máscara FilesystemIterator::current().

`FilesystemIterator::KEY_AS_PATHNAME`

  FilesystemIterator::key() devuelve el nombre del camino.

`FilesystemIterator::KEY_AS_FILENAME`

  FilesystemIterator::key() devuelve el nombre del fichero.

`FilesystemIterator::FOLLOW_SYMLINKS`

  Hace que RecursiveDirectoryIterator::hasChildren() siga los enlaces simbólicos.

`FilesystemIterator::KEY_MODE_MASK`

  Máscara FilesystemIterator::key().

`FilesystemIterator::NEW_CURRENT_AND_KEY`

  Idéntico a `FilesystemIterator::KEY_AS_FILENAME | FilesystemIterator::CURRENT_AS_FILEINFO`.

`FilesystemIterator::OTHER_MODE_MASK`

  Máscara utilizada para FilesystemIterator::getFlags() y FilesystemIterator::setFlags().

`FilesystemIterator::SKIP_DOTS`

  Ignora los ficheros puntos (`.` y `..`).

`FilesystemIterator::UNIX_PATHS`

  Los caminos utilizan el separador de directorio de tipo Unix, es decir, la barra, independientemente del sistema operativo. Tenga en cuenta que el `camino` que se pasa al constructor no se modifica.

## Tabla de contenidos

- FilesystemIterator::__construct — Construye un objeto FilesystemIterator
- FilesystemIterator::current — Lee el fichero actual
- FilesystemIterator::getFlags — Lee las opciones activadas
- FilesystemIterator::key — Lee el nombre del fichero
- FilesystemIterator::next — Moverse al siguiente fichero
- FilesystemIterator::rewind — Reinicia la lectura del directorio
- FilesystemIterator::setFlags — Configura las opciones

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