Get the permissions of current DirectoryIterator item in PHP
Description
The following code shows how to get the permissions of current DirectoryIterator item.
Example
/*from w ww. ja v a 2 s . c om*/
<?php
$iterator = new DirectoryIterator(dirname(__FILE__));
foreach ($iterator as $fileinfo) {
if (!$fileinfo->isDot()) {
$octal_perms = substr(sprintf('%o', $fileinfo->getPerms()), -4);
echo $fileinfo->getFilename() . " " . $octal_perms . "\n";
}
}
?>
The code above generates the following result.