GlobIterator
class GlobIterator extends FilesystemIterator implements Countable (View source)
Iterates through a file system in a similar fashion to glob.
Constants
CURRENT_MODE_MASK |
|
CURRENT_AS_PATHNAME |
|
CURRENT_AS_FILEINFO |
|
CURRENT_AS_SELF |
|
KEY_MODE_MASK |
|
KEY_AS_PATHNAME |
|
FOLLOW_SYMLINKS |
|
KEY_AS_FILENAME |
|
NEW_CURRENT_AND_KEY |
|
SKIP_DOTS |
|
UNIX_PATHS |
|
OTHER_MODE_MASK |
|
Methods
Construct a directory using glob
Gets an SplFileInfo object for the path
Gets an SplFileObject object for the file
Sets the class name used with SplFileInfo::openFile
Sets the class used with getFileInfo and getPathInfo
Check whether current DirectoryIterator position is a valid file
Get the number of directories and files
Details
__construct($pattern, int $flags = FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO)
Construct a directory using glob
string
getPath()
Gets the path without filename
string
getFilename()
Gets the filename
string
getExtension()
Gets the file extension
string
getBasename(string $suffix = '')
Gets the base name of the file
string
getPathname()
Gets the path to the file
int|false
getPerms()
Gets file permissions
int|false
getInode()
Gets the inode for the file
int|false
getSize()
Gets file size
int|false
getOwner()
Gets the owner of the file
int|false
getGroup()
Gets the file group
int|false
getATime()
Gets last access time of the file
int|false
getMTime()
Gets the last modified time
int|false
getCTime()
Gets the inode change time
string|false
getType()
Gets file type
bool
isWritable()
Tells if the entry is writable
bool
isReadable()
Tells if file is readable
bool
isExecutable()
Tells if the file is executable
bool
isFile()
Tells if the object references a regular file
bool
isDir()
Tells if the file is a directory
bool
isLink()
Tells if the file is a link
string|false
getLinkTarget()
Gets the target of a link
string|false
getRealPath()
Gets absolute path to file
SplFileInfo
getFileInfo(T> $class = null)
Gets an SplFileInfo object for the file
SplFileInfo|null
getPathInfo(T> $class = null)
Gets an SplFileInfo object for the path
SplFileObject
openFile(string $mode = 'r', bool $useIncludePath = false, resource $context = null)
Gets an SplFileObject object for the file
void
setFileClass(T> $class = SplFileObject::class)
Sets the class name used with SplFileInfo::openFile
void
setInfoClass(T> $class = SplFileInfo::class)
Sets the class used with getFileInfo and getPathInfo
string
__toString()
Returns the path to the file as a string
final void
_bad_state_ex()
No description
__wakeup()
No description
array
__debugInfo()
No description
bool
isDot()
Determine if current DirectoryIterator item is '.' or '..'
void
rewind()
Rewinds back to the beginning
bool
valid()
Check whether current DirectoryIterator position is a valid file
mixed
key()
Retrieve the key for the current file
mixed
current()
The current file
void
next()
Move to the next file
void
seek(int $offset)
Seek to a DirectoryIterator item
int
getFlags()
Get the handling flags
void
setFlags(int $flags)
Sets handling flags
int
count()
Get the number of directories and files