157,165c157,165 < if ( ! $recursive || ! $this->is_dir($file) ) { < if ( ! function_exists('ftp_chmod') ) < return @ftp_site($this->link, sprintf('CHMOD %o %s', $mode, $file)); < return @ftp_chmod($this->link, $mode, $file); < } < //Is a directory, and we want recursive < $filelist = $this->dirlist($file); < foreach ( $filelist as $filename ) { < $this->chmod($file . '/' . $filename, $mode, $recursive); --- > if ( $recursive && $this->is_dir($file) ) { > //fetch contents of the directory > $filelist = $this->dirlist($file); > //make sure the directory isn't empty by testing for the presence of a returned array > if(is_array($filelist)) { > foreach ($filelist as $filename=>$metadata ) { > $this->chmod($file . '/' . $filename, $mode, $recursive); > } > } 167c167,170 < return true; --- > //chmod the file or directory > if ( ! function_exists('ftp_chmod') ) > return @ftp_site($this->link, sprintf('CHMOD %o %s', $mode, $file)); > return @ftp_chmod($this->link, $mode, $file);