Я хочу рекурсивно установить права доступа к папке и файлу. Папки должны получить 750 и файлы 644. Я нашел это и сделал некоторые адаптации. Будет ли это работать?
<?php
function chmod_r($Path) {
$dp = opendir($Path);
while($File = readdir($dp)) {
if($File != "." AND $File != "..") {
if(is_dir($File)){
chmod($File, 0750);
}else{
chmod($Path."/".$File, 0644);
if(is_dir($Path."/".$File)) {
chmod_r($Path."/".$File);
}
}
}
}
closedir($dp);
}
?>