DirectoryIterator::isFile
DirectoryIterator::isReadable
DirectoryIterator
PHP Manual

# DirectoryIterator::isLink

(PHP 5 <= 5.1.1)

DirectoryIterator::isLink — Determine if current DirectoryIterator item is a symbolic link

### 설명

public bool DirectoryIterator::isLink ( void )

Determines if the current DirectoryIterator item is a symbolic link.

### 인수

이 함수는 인수가 없습니다.

### 반환값

Returns `TRUE` if the item is a symbolic link, otherwise `FALSE`

### 예제

Example #1 A DirectoryIterator::isLink example

This example contains a recursive function for removing a directory tree.

`<?php
/**
* This function will recursively delete all files in the given path, without
* following symlinks.
*
* @param string $path Path to the directory to remove.
*/
function removeDir($path) {
$dir = new DirectoryIterator($path);
foreach ($dir as $fileinfo) {
if ($fileinfo->isFile() || $fileinfo->isSymlink()) {
unlink($fileinfo->getPathName());
} elseif (!$fileinfo->isDot() && $fileinfo->isDir()) {
removeDir($fileinfo->getPathName());
}
}
rmdir($path);
}
removeDir('foo');
?>`

### 참고

- DirectoryIterator::getType - Determine the type of the current DirectoryIterator item
- DirectoryIterator::isDir - Determine if current DirectoryIterator item is a directory
- DirectoryIterator::isDot - Determine if current DirectoryIterator item is '.' or '..'
- DirectoryIterator::isFile - Determine if current DirectoryIterator item is a regular file

DirectoryIterator::isFile
DirectoryIterator::isReadable
DirectoryIterator
PHP Manual