addFolder($path); while (($file = readdir($dh)) !== false) { if ($file === '.' || $file === '..') { continue; } if (is_dir($source . '/' . $file)) { $this->addRecursive($path . '/' . $file, $source . '/' . $file); } else { $this->addFile($path . '/' . $file, $source . '/' . $file); } } } } }