public static function recursiveChmod($path, $filePerm = 0644, $dirPerm = 0755)
    {

        // don't do anything under Windows
        if (FileSystem::getOsIdentifier() === self::OS_IDENTIFIER_WIN) {
            return;
        }

        // check if the directory exists
        if (is_dir($path) === false) {
            return false;
        }

        // get all the files recursively
        $files = FileSystem::globDir($path . '/*');

        // iterate over all directories and files
        foreach ($files as $file) {
            // see whether this is a file
            if (is_file($file)) {
                // chmod the file with our given file permissions
                FileSystem::chmod($file, $filePerm);
            // if this is a directory...
            } elseif (is_dir($file)) {
                // chmod the directory itself
                FileSystem::chmod($file, $dirPerm);
            }
        }

        // change the permmissions of the directory itself
        FileSystem::chmod($path, $dirPerm);
    }
public static function recursiveChmod($path, $filePerm = 0644, $dirPerm = 0755)
    {

        // don't do anything under Windows
        if (FileSystem::getOsIdentifier() === self::OS_IDENTIFIER_WIN) {
            return;
        }

        // check if the directory exists
        if (is_dir($path) === false) {
            return false;
        }

        // get all the files recursively
        $files = FileSystem::globDir($path . '/*');

        // iterate over all directories and files
        foreach ($files as $file) {
            // see whether this is a file
            if (is_file($file)) {
                // chmod the file with our given file permissions
                FileSystem::chmod($file, $filePerm);
            // if this is a directory...
            } elseif (is_dir($file)) {
                // chmod the directory itself
                FileSystem::chmod($file, $dirPerm);
            }
        }

        // change the permmissions of the directory itself
        FileSystem::chmod($path, $dirPerm);
    }
public static function recursiveChmod ( $ path , $ filePerm = 0644 , $ dirPerm = 0755 ) { // don't do anything under Windows if ( FileSystem :: getOsIdentifier ( ) === self :: OS_IDENTIFIER_WIN ) { return ; } // check if the directory exists if ( is_dir ( $ path ) === false ) { return false ; } // get all the files recursively $ files = FileSystem :: globDir ( $ path . '/*' ) ; // iterate over all directories and files foreach ( $ files as $ file ) { // see whether this is a file if ( is_file ( $ file ) ) { // chmod the file with our given file permissions FileSystem :: chmod ( $ file , $ filePerm ) ; // if this is a directory... } elseif ( is_dir ( $ file ) ) { // chmod the directory itself FileSystem :: chmod ( $ file , $ dirPerm ) ; } } // change the permmissions of the directory itself FileSystem :: chmod ( $ path , $ dirPerm ) ; }
Chmods files and folders with different permissions.

This is an all-PHP alternative to using: \n
<tt>exec("find ".$path." -type f -exec chmod 644 {} \;");</tt> \n
<tt>exec("find ".$path." -type d -exec chmod 755 {} \;");</tt>

@param string $path     Relative or absolute path to a file or directory which should be processed.
@param int    $filePerm The permissions any found files should get.
@param int    $dirPerm  The permissions any found folder should get.

@return void
Chmods files and folders with different permissions .